This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include: | |
- git | |
apache: | |
pkg.installed: | |
- name: httpd | |
service.running: | |
- name: httpd | |
- enable: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Actions = new Rx.Subject(); | |
Actions.onCompleted = () => {}; // never complete | |
var act = (tag, data = {}) => ({tag, data}); | |
var send = tag => data => Actions.onNext(act(tag, data)); | |
var Dispatcher = Actions.asObservable(); | |
// ---------------------------------------------------------------------------- | |
var C = constants = { | |
GET_USER: 'get_user', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Misc collection of shorthand helper functions for Flux implemented with Rx | |
**/ | |
import Rx from 'rx'; | |
import _ from 'lodash'; | |
import formSerialize from 'form-serialize'; | |
Rx.Observable.prototype.byTag = byTag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Central xhr progress tracker. Used for both a global | |
// activity indicator as well as granular spinners within in a page. | |
var Progress$ = new Rx.Subject(); | |
// Make an xhr call and make a tag to track the progress ticks. | |
var users$ = Rx.DOM.ajax({ | |
method: 'GET', | |
url: 'https://api.github.com/users', | |
responseType: 'json', | |
progressObserver: Rx.Observer.create( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Proof-of-concept server-sent events HTTP server using Node.js and RxJS | |
Open http://localhost:8000 in a browser and view the console. | |
**/ | |
var http = require('http'), | |
https = require('https'); | |
var Rx = require('rx'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only required on Python 2 | |
futures==3.0.3 | |
tornado==4.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Alternative to Observable.fromCallback that does not complete itself | |
In the example below `fnThatTakesCallback` is a function that takes a callback | |
as the final parameter. The function will be invoked with `arg1` and `arg2` and | |
when the callback is called the values will show up in the observable stream. | |
If `fnThatTakesCallback` requires a particular context use the call method | |
e.g., `fromCallbackAll.call(context, fnThatTakesCallback, [...], ...)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint no-param-reassign:0 */ | |
import React from 'react'; | |
import _ from 'lodash'; | |
module.exports = h; | |
var classIdSplit = /([\.#]?[a-zA-Z0-9_:-]+)/; | |
var notClassId = /^\.|#/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Place this file in /srv/reactor/process_status_updates.sls | |
Call via sending a custom event on a minion as: | |
salt-call event.send myco/external_task/status_update task=foo status='Update number one!' | |
Requires reactor config such as: | |
reactor: | |
- 'myco/external_task/status_update': | |
- /srv/reactor/process_status_updates.sls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
./streamreader.py 'http://localhost:8000/events?salt_token=078c5f808b077f1e9f8dbc7408420cef' 'http://localhost:8000/events?salt_token=103ba8c5c54c46817a7153038638a9f1' 'http://localhost:8000/events?salt_token=4b12844a06b25411daf5aa0dfdcc7628' | |
''' | |
import asyncio | |
import json | |
import sys | |
import urllib.parse |