Skip to content

Instantly share code, notes, and snippets.

View basdirks's full-sized avatar

Bas Dirks basdirks

View GitHub Profile
@basdirks
basdirks / scoring
Last active August 29, 2015 14:22 — forked from joebo/scoring
tbl=:3 4 $ 0; 2; 'A'; 'B'; 3; 1; 'B'; 'C'; 1; 1; 'C'; 'A'
init=:((~. @: , @: (2&}."1)) ; (0 #~ #)) tbl
NB. given a table of team scores, score a game and return new team score
score =: 4 : 0
'allteams scores'=. > y
diff =. - / (> @: (2&{.)) > x
teams=. 2&}. > x
allteamIdx=. allteams i. teams
assert.response(server, {
url: '/',
method: 'GET'
}, {
status: 200
}, 'X Failed to return .css extension for /index.css');
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
@basdirks
basdirks / gist:1055942
Created June 30, 2011 09:48
multiples
multiples: (from, to, factors...) ->
((for x in factors
([from..to].filter (y) -> y % x is 0)).reduce (xs, x) ->
xs.concat x).sort (a, b) -> a - b