Create a Babel plugin that replaces the following symbols.
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 = Object.freeze({ | |
createSelector: function (selector, processor) { | |
var cache = {}, processed; | |
return function (state) { | |
var selected = selector(state); | |
if (selected !== cache) { | |
processed = processor(selected); |
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 = (key, secret) -> (key2) -> if key is key2 then secret |
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
tell application "Spotify" | |
set tNumber to track number of current track as integer | |
set tDisc to disc number of current track as integer | |
set tDuration to duration of current track as integer | |
set tName to name of current track as string | |
set tArtist to artist of current track as string | |
set tAlbum to album of current track as string | |
set tAlbumArtist to album artist of current track as string | |
set meta to tNumber & ";" & tDisc & ";" & tDuration & ";" & tName & ";" & tArtist & ";" & tAlbum & ";" & tAlbumArtist & " | |
" |
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
var bind = function () { | |
var args = Array.from(arguments) | |
var fn = args.shift() | |
return function () { | |
return fn(...args.concat(Array.from(arguments))) | |
} | |
} |
See is-iterable
.