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
require 'spintax_parser' | |
class String | |
include SpintaxParser | |
end |
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
spintext = "{Hello|Hi} {{world|worlds}|planet}{!|.|?}" | |
10.times do | |
puts spintext.unspin | |
end |
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
class CompositeView extends Backbone.View | |
initialize: (options) -> | |
super(options) | |
@children = _([]) | |
renderChild: (child) -> | |
@children.push child | |
child.parent = this | |
child.render() |
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
module.exports = class SwappingRouter extends Backbone.Router | |
execute: (callback, args) -> | |
@params = @_parseParams args.pop() | |
callback?.apply this, args | |
navigate: (fragment, options={}) -> | |
url = new URI fragment.replace('#','') | |
url.query options.params if options.params? | |
super "##{url.toString()}", _.omit(options, 'params') |
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 m = require('mithril') | |
const stated = hook => vnode => vnode.state[hook](vnode) | |
const oninit = Comp => vnode => { | |
vnode.state.oncreate = m.prop() | |
vnode.state.onremove = m.prop() | |
vnode.state.view = Comp(vnode) | |
} |
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 identity = require('ramda/src/identity') | |
const qs = require('qs') | |
const Task = require('./task') | |
const parseHeaders = identity | |
const request = opts => Task((reject, resolve) => { | |
var { | |
data, |
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 Layout = Child => props => | |
<div> | |
<header></header> | |
<main> | |
<Child /> | |
</main> | |
</div> | |
export default Layout |
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
init = { | |
all: {}, | |
head: null, | |
last: null | |
} | |
list = { | |
all: { | |
1: { | |
id: '1', |
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 compose = (...fs) => x => { | |
let i = fs.length | |
while(i--) x = fs[i](x) | |
return x | |
} |