See is-iterable
.
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
factory = (a) -> foo: 'bar' | |
module.exports = factory |
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
container = require('intravenous').create | |
onDispose: (m) -> delete m.data | |
originalId = Math.random() | |
container.register 'bucket', {original: originalId}, 'singleton' | |
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
maybe = -> | |
fns = [] | |
monad = (input) -> fns.reduce ((v, fn) -> fn v), input | |
Object.assign monad, with: (fn) -> | |
fns.push (v) -> if v? then fn v else null | |
monad |
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
sum = require './sum' | |
for name, fn of sum | |
start = Date.now() | |
i = 500000 | |
while i > 0 | |
n = fn 1000, 0 | |
i-- | |
end = Date.now() | |
console.log name, end - start |
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
# assuming you are in the rplan repo | |
brew update | |
brew upgrade | |
brew install docker docker-compose | |
brew cask install vmware-fusion | |
ln -s /opt/homebrew-cask/Caskroom/vmware-fusion/8.0.2-3164312/VMware\ Fusion.app /Applications/VMware\ Fusion.app |
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
var bind = function () { | |
var args = Array.from(arguments) | |
var fn = args.shift() | |
return function () { | |
return fn(...args.concat(Array.from(arguments))) | |
} | |
} |
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
// from http://blog.simonwillison.net/post/57956816139/escape | |
module.exports = (regex) => regex.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') |
Taken from the wonderful sloc
tool.
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
sudo mkdir /foo | |
sudo mount /dev/sda1 /foo # system partition | |
sudo mount /dev/sda2 /foo/boot/efi # EFI System Partition | |
sudo mount -o bind /dev /foo/dev | |
sudo mount -o bind /sys /foo/sys | |
sudo mount -t proc /proc /foo/proc | |
sudo cp /proc/mounts /foo/etc/mtab | |
sudo chroot /foo /bin/bash | |
# in root shell: |