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
| {"lastUpload":"2017-08-21T19:14:37.242Z","extensionVersion":"v2.8.3"} |
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 makeFieldFn = (key) => (x) => (e) => e[key] === x; | |
| module.exports = { | |
| typeIs: makeFieldFn('type'), | |
| keyCodeIs: makeFieldFn('keyCode'), | |
| keyCodeIsIn: (range) => (e) => range.indexOf(e.keyCode) !== -1, | |
| }; |
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
| module.exports = | |
| component-will-mount: !-> (@bus = new Bacon.Bus).onValue! | |
| component-will-unmount: !-> @bus.end! | |
| plug: (es) -> @bus.plug es |
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
| var B = require('baconjs'); | |
| var request = require('superagent'); | |
| var config = [{ | |
| pattern: "http://my.com(.*)", | |
| fixtures: function (match, params, headers) { | |
| if (match[1] === '/404') { | |
| throw new Error(404); | |
| } |
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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
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
| window <<< React.DOM | |
| console.log h1, 'h1' | |
| # works properly | |
| React.render(h1(null,'foo'), document.body) | |
| Bar = React.createClass do | |
| render: -> h1 null, 'bar' | |
| # !!!throws an error: Uncaught TypeError: Cannot read property '__reactAutoBindMap' of undefined |
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
| decode = (s) -> | |
| s.replace /\\u([0-9a-f]{4})/gi, (_,r) -> String.fromCharCode parseInt(r,16) |
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
| # divisor adjusts sequence rate, e.g. value of 2 means that new values are produced on even frames only | |
| # Thus Bacon.repeatedlyOnFrame(values, 6) is barely equivalent to 100ms timeout at 60fps | |
| Bacon.repeatedlyOnFrame = (values, divisor = 1) -> | |
| index = 0 | |
| Bacon.scheduleAnimFrame() | |
| .scan 0, -> it + 1 | |
| .filter (tick) -> !(tick % divisor) | |
| .map (tick) -> | |
| values[index++ % values.length] |
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
| tasks = [ | |
| {done:false, results:[]} | |
| {done:true, results:[]} | |
| ] | |
| isDone = -> | |
| tasks.filter((x)->x.done).length is tasks.length | |
| Bacon.later(20000).assign(-> tasks[0].done = 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
| maybe = (fn) -> -> | |
| return if arguments.length is 0 | |
| for arg in arguments | |
| return if !arg? | |
| fn.apply(@, arguments) | |
| # Usage | |
| Z = maybe((n)->n*n) |
NewerOlder