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
# 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 | |
# fb.link returns a $firebase link |
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
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]] |
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
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=> |
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
/* | |
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' |
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
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 |
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 NameInput = makeInputControl({ | |
label: 'Enter your name', | |
className: 'name', | |
}) | |
const EmailInput = makeInputControl({ | |
label: 'Enter your email', | |
className: 'email', | |
}) |
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
import { | |
split, pipe, converge, slice, unfold, pair, append, splitAt, | |
lte, ifElse, length, concat, | |
prop, over, lensProp, | |
F, | |
} from 'ramda' | |
import {_BOL, _EOL} from './util' | |
const toTokens = pipe(split(' '), append(_EOL), concat([_BOL, _BOL, _BOL])) |
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
// ==UserScript== | |
// @name Toggl on Trello | |
// @namespace http://tampermonkey.net/ | |
// @version 0.4 | |
// @description Shows toggl entries that match C### where ### is the card number. | |
// @author [email protected] | |
// @match https://trello.com/c/*/* | |
// @match https://trello.com/b/*/* | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @grant GM_setValue |
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
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { ActivatedRouteSnapshot, Resolve } from '@angular/router'; | |
import { | |
Opp, | |
OppService, | |
Project, | |
ProjectService, | |
RequestService, | |
Request, |
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 flatten = (arr: Array<any>): Array<any> => | |
arr.reduce((a, x) => a.concat(flattenOrArray(x)), []) | |
const flattenOrArray = (x: any) => | |
Array.isArray(x) ? flatten(x) : [x] | |
test('no nesting', () => { | |
expect(flatten([1, 2, 3])).toEqual([1, 2, 3]) | |
}) |
OlderNewer