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
macro inline_find { | |
rule { ($list:expr, function ($value:ident, $index:ident, $ref:ident) { | |
$return:expression | |
}, $context:expr) } => { | |
(function ($ref) { | |
var length = $ref.length; | |
for (var $index = 0; $index < length; $index += 1) { | |
var $value = $ref[$index]; | |
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
macro inline_findIndex { | |
rule { ($list:expr, function ($value:ident, $index:ident, $ref:ident) { | |
$return:expr | |
}, $context:expr) } => { | |
(function ($ref) { | |
var length = $ref.length; | |
for (var $index = 0; $index < length; $index += 1) { | |
var $value = $ref[$index]; | |
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
macro π { | |
rule {} => { Math.PI } | |
} | |
export π; |
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
context.f(...args) | |
f.call(context, ...args) | |
Function.prototype.call.bind(f)(context, ...args) | |
Function.prototype.bind.bind(Function.prototype.call)(f)(context, ...args) |
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 foldr = Function.prototype.call.bind(Array.prototype.reduceRight); | |
var source = [9, 8, 7]; | |
var pipeline = compose(filter(odd), map(add(1))); | |
var pusher = { | |
step: function (arr, value) { arr.push(value); return arr; }, | |
result: identity | |
}; |
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 VDOMWorkerRenderer = require('./vdom-worker-renderer'); | |
var renderer = new VDOMWorkerRenderer(function (h) { | |
return function ui(state) { | |
return counter(state.counter) | |
}; | |
function counter(value) { | |
return h('div', { className: 'counter' }, [String(value)]); | |
} |
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
/* | |
ES7 | |
``` | |
async function f() { | |
await ... | |
} | |
``` |
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
class Class { | |
@Bound | |
method() {} | |
@Lazy | |
get data() {} | |
} | |
function Bound(prototype, name, descriptor) { | |
const { value, writable, enumerable, configurable } = descriptor; |
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
import sublime, sublime_plugin | |
# Takes an array of commands (same as those you'd provide to a key binding) with | |
# an optional context (defaults to view commands) & runs each command in order. | |
# Valid contexts are 'text', 'window', and 'app' for running a TextCommand, | |
# WindowCommands, or ApplicationCommand respectively. | |
class RunMultipleCommandsCommand(sublime_plugin.TextCommand): | |
def exec_command(self, command): | |
if not 'command' in command: |
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 (global, document, url) { | |
var calls = []; | |
var spy = {}; | |
var methods = ['config', 'install', 'setUserContext', 'captureException']; | |
for (var i = 0, method; method = methods[i]; i += 1) { | |
spy[method] = (function (name) { | |
return function () { | |
calls.push([name, arguments]); | |
return this; |