Skip to content

Instantly share code, notes, and snippets.

View factory.js
const NameInput = makeInputControl({
label: 'Enter your name',
className: 'name',
const EmailInput = makeInputControl({
label: 'Enter your email',
className: 'email',
View chrome trace
makeDOMDriver.js:78 TypeError: Cannot convert undefined or null to object(…)defaultOnErrorFn
@ makeDOMDriver.js:78Rx.AnonymousObserver.AnonymousObserver.error
@ rx.all.js:1836Rx.internals.AbstractObserver.AbstractObserver.onError
@ rx.all.js:1772tryCatcher
@ rx.all.js:63InnerObserver.error
@ rx.all.js:4574Rx.internals.AbstractObserver.AbstractObserver.onError
@ rx.all.js:1772tryCatcher
@ rx.all.js:63AutoDetachObserverPrototype.error
@ rx.all.js:11818Rx.internals.AbstractObserver.AbstractObserver.onError
@ rx.all.js:1772InnerObserver.error
View crazyCycleBackend.js
I have a queue that clients submit tasks to, this backend worker consumes them
firebaseDriver: provides a function that generates a one-element observable of a firebase location
queueConsumerDriver: provides a source of all incoming requests, consumes a sink that takes responses
knows via the uid in the response what channel to send it back on
import {makeFirebaseDriver, makeQueueConsumerDriver} from 'cyclic-fire'
View firebaseDriver.js
import Rx from 'rx'
import Firebase from 'firebase'
const FbStream = (ref,evtName)=>
Rx.Observable.create( obs=> ref.on( evtName, (snap)=>obs.onNext(snap) ) )
const AddedStream = ref=>
FbStream(ref,'child_added').map( snap => acc => ({[snap.key()]:snap.val(), ...acc}) )
const ChangedStream = ref=>
from random import sample, shuffle
from string import ascii_lowercase
class Game(object):
def __init__(self,player_count, mins_per_player, gains_per_min, gains_per_reform):
self.player_count, self.mins_per_player, self.gains_per_reform, self.gains_per_min = player_count, mins_per_player, gains_per_reform, gains_per_min
self.total_mins = self.player_count * self.mins_per_player
self.minset = [l for l in ascii_lowercase[:self.total_mins]]
sdebaun /
Created Jan 2, 2014
Trying to figure out how to have ui.route with stateParams and angularfire bindings work together. I have a list controller that shows a list of games. The html elements in that list should use ui-sref to provide a link to the detail state for a given game. The problem: I am trying to get a game's key so that I can tell the detail state to look …
# in my app config, the route...
.state 'games.list',
url: '/list'
controller: "GameListControl"
.state 'games.detail',
url: '/detail/{gameId:.*}'
controller: "GameDetailControl"
# fb.* methods are from my custom factory
# returns a $firebase link