by @rane
Tori.fi, a Finnish online marketplace based on blocket.se, has a category selection input that dynamically reveals sub-categories as user selects them.
It works like this:
#!/bin/sh | |
# Find files with trailing whitespace | |
for FILE in `exec git diff --name-only HEAD -- | sed '/^[+-]/d' | sed -E 's/:[0-9]+:.*//' | uniq` ; do | |
sed -i '' -E 's/[[:space:]]*$//' "$FILE" | |
done |
const { Future, IO } = require('ramda-fantasy'); | |
const join2 = curryN(2, require('path').join); | |
const npa = require('npm-package-arg'); | |
const ALIAS = /:([^!]+)/; | |
const EXTEND = /!$/; | |
const parseAlias = pipe( | |
S.match(ALIAS), chain(nth(1))); | |
const parseExtend = pipe( | |
S.match(EXTEND), map(T)); |
~ ❯❯❯ cat ~/noderepl/myrepl.js | |
var repl = require('repl').start('> '); | |
require('repl.history')(repl, process.env.HOME + '/.node_history'); | |
var R = repl.context.R = require('ramda'); | |
R.functions(R).forEach(function(f) { | |
repl.context[f] = R[f]; | |
}); | |
repl.context.treis = require('treis'); |
const cachedReadFile = (function() { | |
const cache = new Map(); | |
return (p) => { | |
if (cache.has(p)) return Promise.resolve(cache.get(p)); | |
else return readFile(p).tap((file) => cache.set(p, file)); | |
} | |
}()); |
require! ramda: {pipe, evolve, props, filter, join} | |
require! chalk: {grey, yellow, cyan, green, red} | |
color-status-code = -> | |
| it >= 500 => red it | |
| it >= 400 => yellow it | |
| it >= 300 => cyan it | |
| it >= 200 => green it | |
module.exports = pipe do |
var h = require('snabbdom/h'); | |
var patch = require('snabbdom').init([]); | |
var container = document.getElementById('container'); | |
var vnode = h('div#foo', {}, 'not id foo'); | |
patch(container, vnode); |
require! <[ watchify browserify gulp ]> | |
require! 'vinyl-source-stream': source | |
require! 'vinyl-buffer': buffer | |
require! 'gulp-util': gutil | |
require! 'liveify' | |
gulp.task \bundle !-> | |
bundler = watchify browserify {} <<< watchify.args <<< | |
entries: ['./src/index.ls'] | |
debug: true |
by @rane
Tori.fi, a Finnish online marketplace based on blocket.se, has a category selection input that dynamically reveals sub-categories as user selects them.
It works like this:
gist-clone() { | |
gist_id=`echo "$1" | sed -e 's/.*\///g'` | |
git clone git@gist.github.com:/$gist_id.git $2 | |
} |