{
"jquery": {
"commonjs": "jquery-browser",
"requirejs": "jquery",
"global": "jQuery"
}
}
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
# ## Function: sequence | |
# | |
# Evaluates each action in sequence, left to right, collecting the | |
# results. | |
# | |
# + type: (Monad m) => m -> [m a] -> m [a] | |
export sequence = (m, ms) --> do | |
return ms.reduce perform, m.of [] | |
# where: | |
function perform(m1, m2) => do |
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
{posts, blog} = require './download.json' | |
pandoc = require \pandoc | |
fs = require \fs | |
photos = (.join '') . (.map -> """<img src="#{it.original_size.url}" width="#{it.original_size.width}" height="#{it.original_size.height}" alt="#{it.caption}">""") | |
pad = (n, s)-> | |
p = n - s.to-string!length | |
('0' * p) + s |
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
fit = (coins, amt)--> | |
maximum filter (<= amt), coins | |
fit-sterling = fit [1 2 5 10 20 50 100 200] | |
change = (fit, amt)--> | |
| amt is 0 => [] | |
| otherwise => let coin = fit amt | |
[coin] ++ change fit, (amt - coin) |
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
function gatedAsync(fn) { | |
var running = false, queue = []; | |
return function(...args) { | |
if(running) { | |
queue.push([run, args]); | |
} else { | |
run(...args); | |
} | |
function run(...args) { |
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
readonly files="path/to/scripts/entry.js" | |
readonly base="path/to/scripts" | |
readonly opts="-t whatever" | |
list_deps() { | |
local entries=$1 | |
local opts=$2 | |
browserify $opts --list $entries \ | |
| sed "s:$(pwd)::" \ |
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
{Status, Header}:handle = require \oban | |
{get, route} = require \livewire | |
ok = ([Status 200] ++) | |
not-found = ([Status 404] ++) | |
with-header = (k,v,s)--> [Header k,v] ++ s | |
handle route [ | |
get '/' -> ok "hello world" | |
(req)-> not-found "#{req.url} not found" |
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
{root, post, put, delete} = require \sodor | |
module.exports = | |
index: root -> | |
new: -> | |
create: post root -> | |
show: root (id)-> | |
edit: (id)-> | |
update: put root (id)-> | |
destroy: delete root (id)-> |
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
macro (~) { | |
rule infix { $l:expr | $r:ident } => { (ref = $l, ref.$r.bind(ref)) } | |
rule infix { $l:expr | $r:expr } => { (ref = $l, ref[$r].bind(ref)) } | |
} | |
var c = a~b; | |
a({ | |
b: c~(foo) | |
}); |
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 sequence = (M, ms)=> ms.reduce( | |
(m1, m2)=> do(M, function*() { | |
var x = yield m1; | |
var xs = yield m2; | |
return x.concat(xs); | |
}), M.of([])); | |
// should be eqv to | |
var sequence = (M, ms)=> ms.reduce( |