This file contains hidden or 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 ticker = (ctx) => (cb) => { | |
| const interval = setInterval(() => { | |
| cb("TICK"); | |
| }, ctx.interval * 1000); | |
| return () => clearInterval(interval); | |
| }; | |
| const timerFinished = (ctx) => ctx.remaining === 0; | |
This file contains hidden or 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 timerMachine = Machine({ | |
| initial: 'running', | |
| context: { | |
| elapsed: 0, | |
| duration: 5, | |
| interval: 0.1 | |
| }, | |
| states: { | |
| running: { |
This file contains hidden or 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 infiniteScrollMachine = Machine( | |
| { | |
| id: 'infiniteScroll', | |
| initial: 'fetchingRowOfData', | |
| context: { | |
| totalEntries: Infinity, | |
| data: [], |
This file contains hidden or 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 stateMachine = Machine({ | |
| id: 'schedules pass', | |
| type: "parallel", | |
| states: { | |
| happy_path: { | |
| initial:"init", | |
| states: { | |
| init: { | |
| on:{ | |
| REQUEST_BOOKING:"booking_pending" |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| <script src="http://jashkenas.github.io/underscore/underscore-min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> |
This file contains hidden or 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
| getFloorY = function(item) { | |
| return dims.atticHeight + item.room * dims.roomHeight - dims.floorHeightChars - item.height; | |
| } | |
| if() { // below bsment | |
| } else { // above | |
| if (item.dragged) { | |
| for (var i = 0; i < floors.length; i++) { |
This file contains hidden or 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
| //common to client and server | |
| SharedCollection = new Meteor.Collection('shared'); | |
| //client from here on out | |
| LocalMirror = new Meteor.Collection(null); | |
| var convertSharedToLocal = function(sharedDoc) { | |
| var localDoc = LocalCollection._deepcopy(sharedDoc); // undocumented API, might change |
This file contains hidden or 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 listCII | |
| var X | |
| foreach line: | |
| if "C" | |
| listCII.add(X) // only if not null | |
| create new object X | |
| if "I" | |
| put object I in X |