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
const payAdvanceService = { | |
orchInitiatePayout: async () => null, | |
orchInitiateRepayment: async () => (send) => { | |
// send({ type: 'initiatedFullAchRepayment' }); | |
}, | |
}; | |
const machine = Machine({ | |
type: 'parallel', |
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
const fetchCuteAnimals = () => { | |
return fetch('https://www.reddit.com/r/aww.json') | |
.then(res => res.json()) | |
.then(data => data.data.children.map(child => child.data)) | |
} | |
const cuteAnimalMachine = Machine({ | |
id: 'cuteAnimals', | |
initial: 'idle', | |
context: { |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Borrowed from https://github.com/adriancooney/console.snapshot/blob/master/console.snapshot.js | |
/* eslint-disable no-console, no-param-reassign */ | |
/** | |
* Since the console.log doesn't respond to the `display` style, | |
* setting a width and height has no effect. In fact, the only styles | |
* I've found it responds to is font-size, background-image and color. | |
* To combat the image repeating, we have to get a create a font bounding | |
* box so to speak with the unicode box characters. |
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
<button onclick="parent.postMessage('close', '*');">Hide</button> |
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
// See http://stackoverflow.com/questions/21934831/nodejs-express-stream-stdout-instantly-to-the-client | |
var cp = require("child_process"), | |
express = require("express"), | |
app = express(); | |
app.get('/', function(req, res){ | |
res.writeHead(200, { "Content-Type": "text/event-stream" }); | |
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
# Learning Angular.js Dependency Injection with examples | |
The hardest part for me to grasp with Angular.js was Dependency Injection and distinctions between services/factories/providers. I have provided some simple examples that made these concepts more clear. | |
## Modules | |
Create a new module like this (second argument is for dependencies). | |
angular.module('myModule', []); |
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
/** | |
* Lets make a service rather than refering to firebase directly | |
* | |
* Copied and tweeked from angularFire-seed. | |
* https://github.com/firebase/angularFire-seed/blob/master/app/js/service.firebase.js | |
* | |
* For use with bower. | |
* bower install https://gist.github.com/8834003.git --save | |
**/ | |
define(["angularfire"], function() { |