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
const assertRejectedWith = (p, fn) => | |
Promise.all([ | |
assert.isRejected(p), | |
p.catch(fn) | |
]); | |
const assertRejectedWithMsg = (p, str) => | |
assertRejectedWith(p, err => assert.deepEqual(err.message, str)) | |
it('throws if body can\'t be found for the email type', () => { |
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! AgSearchAndReplaceCursor() | |
let search = expand('<cword>') | |
execute "Ag! " . search | |
call feedkeys(':QFdo %s/' . search . "//gc") | |
call feedkeys("\<Left>\<Left>\<Left>") | |
endfunction | |
nmap <space>ac :silent Ag<CR> " word on cursor | |
nmap <space>ag :silent Ag! ""<Left> | |
nmap <space>as :silent AgFromSearch<CR> |
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
const { pickBy } = require('ramda'); | |
const obj = { | |
a: 1, | |
b: 2, | |
A: 3, | |
B: 4 | |
}; | |
// --- |
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
require! ramda: {pipe, map} | |
ssps = | |
* target: 'summarize(stats.incoming.ssp_traffic.aaa, "1hr", "sum")' | |
* target: 'summarize(stats.incoming.ssp_traffic.bbb, "1hr", "sum")' | |
* target: 'summarize(stats.incoming.ssp_traffic.ccc, "1hr", "sum")' | |
ssp-traffic-name-regex = /ssp_traffic.([^,]+),/ | |
# :: [Object] -> [String] |
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
~ ❯❯❯ replem minimatch | |
Installed into REPL context: | |
- [email protected] as minimatch | |
> minimatch("src/foo.txt", "src/**/*") | |
true |
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
const lineLens = lens(split('\n'), join('\n')); | |
const mapLines = curry((fn, str) => | |
over(lineLens, map(fn), str)); | |
const adjustLine = curry((fn, n, str) => | |
over(lineLens, adjust(fn, n), str)) | |
mapLines(toUpper, 'foo\nbar') // => 'FOO\nBAR' | |
adjustLine(toUpper, 0, 'foo\nbar') // => 'FOO\nbar" |
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
~ ❯❯❯ curl -s -k -H "Accept: application/json" https://brackets-registry.aboutweb.com/ | R '.registry' 'find (.metadata.name is "jade-preprocessors")' -o table | |
┌───────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | |
│ metadata.name │ jade-preprocessors │ | |
├───────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ | |
│ metadata.title │ Jade (Preprocessor Fork) │ | |
├───────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ | |
│ metadata.description │ Add first class sup |
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
#!/usr/bin/env bash | |
cat $1 | R -rR --slurp \ | |
'unlines' \ | |
'to-lower' \ | |
'match /\w+/g' \ | |
'lodash.uniq' \ | |
'sort-by length' \ | |
'reverse' \ | |
'take 10' |
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
~ ❯❯❯ cat <<EOF | jade -O '{ nick: "chargen_" }' | |
script(type='text/javascript'). | |
window.nick = !{JSON.stringify(nick)}; | |
EOF | |
<script type="text/javascript">window.nick = "chargen_";</script>% | |
~ ❯❯❯ cat <<EOF | jade -O '{ nick: null }' | |
script(type='text/javascript'). | |
window.nick = !{JSON.stringify(nick)}; | |
EOF |
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
const { curry, anyPass, toPairs, map, flip, propSatisfies, apply, memoize } = require('ramda'); | |
const strContains = curry((needle, haystack) => haystack.indexOf(needle) >= 0); | |
const objSpecToPreds = memoize((spec) => | |
map(apply(flip(propSatisfies)), toPairs(spec))) | |
const whereAny = curry((spec, obj) => | |
anyPass(objSpecToPreds(spec), obj) | |
); |