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
# hard to perfomance | |
className = getClassName(@) | |
newProto = {} | |
_(@__proto__).each((value, name) => | |
newProto[name] = do => | |
if typeof value is 'function' | |
return => | |
consoleMe = ['>>', [className, name].join('.')] | |
consoleMe.push '| call with', arguments if arguments.length > 0 | |
console.log.apply console, consoleMe |
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 findInArray(array, callback) { | |
for (var i = 0, element = array[i], length = array.length; i < length; i++) { | |
if (callback.apply(callback, [element, i, array])) return element; | |
} | |
} |
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
<% | |
$default_branch = 'master'; | |
$message = 'auto-commit'; | |
if (isset($_GET['message']) && $_GET['message'] != '') { | |
$message = $_GET['message']; | |
} | |
$message .= 'from ' . date("Y-m-d H:i:s") | |
$results = array(); |
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
start = 10 | |
maxV = 100000 | |
# --------------------------------------------- | |
begin = process.hrtime() | |
getRandom = (acc, max) -> | |
while acc.indexOf(random) isnt -1 | |
random = Math.floor(Math.random() * max) + 1 | |
random |
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('underscore-contrib') | |
# ------------------------------------------ Helpers | |
middle = (x, y) -> (x + y) / 2 | |
getter = _.curry2(_.flip(_.nth)) | |
# ------------------------------------------ Perf definition | |
Function.prototype.perf = do -> | |
logs = {} |
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
Array::filterMap = (predicate) -> | |
acc = [] | |
for el, i in @ | |
res = predicate(el, i) | |
acc.push(res) if res? | |
return acc |
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
# global helper | |
makeClassSet = (classFunc) -> | |
return (params) -> | |
classArr = [] | |
for className, exp of classFunc(params) | |
classArr.push(className) if exp | |
return classArr.join(' ') | |
# local helper |
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 r() { | |
?><script>console.log.apply(console, ['php:'].concat(<? echo json_encode(func_get_args()); ?>))</script><? | |
} | |
?> |
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
React.createComponent({ | |
mixins: [ | |
loadPropsMixin | |
], | |
loadProps: { | |
users: api.get('/users') | |
}, | |
}) |
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 logs = [] | |
var logger = function (moduleName, eventName, data) { | |
logs.push({ | |
'module': moduleName, | |
'event': eventName, | |
'data': data | |
}); | |
}; |