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
/** | |
* The sample usage of ECMA 5 Mozilla Features Implemented in V8 | |
* https://github.com/joyent/node/wiki/ECMA-5-Mozilla-Features-Implemented-in-V8 | |
* You can use thease new feature of ECMA5 on Node.js as you like. | |
* because there is no IE :) | |
* Order is deferent form original wiki. | |
* Sources are Checked on Node.js v0.5.0(unstable), v0.4.9(stable) | |
* | |
* you can execute this file. | |
* $ node ecma5_on_v8.js |
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
// Lack of tail call optimization in JS | |
var sum = function(x, y) { | |
return y > 0 ? sum(x + 1, y - 1) : | |
y < 0 ? sum(x - 1, y + 1) : | |
x | |
} | |
sum(20, 100000) // => RangeError: Maximum call stack size exceeded | |
// Using workaround |
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 match = [] | |
var _finalizeExpr = function(match) { | |
var vs = match[0] | |
var _iter = match[1] | |
var _done = match[2] | |
var i = 0 | |
var _iterWrappper = function() { | |
if(i === vs.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
// | |
// an experimental flow control library. | |
// please dont ever use this for anything. | |
// | |
var z = function z(f) { | |
if (!(this instanceof z)) { | |
return new z(f); | |
} |
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
// 1. Shorter function syntax. | |
// | |
// This version does not respect "Tennent's correspondence principle" -- it's nothing | |
// more than syntactic sugar for the traditional function syntax. That means when you | |
// see the normal braced body of a function, whether it's a longhand function or this | |
// shorthand version, there's no difference: return, this, and arguments are all tied | |
// to the new function body, and there's no implicit returning of the last expression | |
// result. | |
a.some((x) -> { |
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
/** | |
* Read Linux mouse(s) in node.js | |
* Author: Marc Loehe ([email protected]) | |
* | |
* Adapted from Tim Caswell's nice solution to read a linux joystick | |
* http://nodebits.org/linux-joystick | |
* https://github.com/nodebits/linux-joystick | |
*/ | |
var fs = require('fs'), |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
// A private name used by the Monster class | |
const pHealth = Name.create(); | |
class Monster { | |
// A method named "new" defines the class’s constructor function. | |
new(name, health) { | |
this.name = name; | |
this[pHealth] = health; |
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 (exports) { | |
// These aliases can be safely removed. | |
var toString = {}.toString, hasOwn = {}.hasOwnProperty, | |
// **defer** attempts to execute a callback function asynchronously in supported | |
// environments. | |
defer = function (callback, context) { | |
// `process.nextTick` is an efficient alternative to `setTimeout(..., 0)`. | |
// As of Node 0.6.9, neither `process.nextTick` nor `setTimeout` isolate | |
// execution; if the `callback` throws an exception, subsequent deferred |
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
git log --all --pretty=format:"%h %cd %s (%an)" --since='7 days ago' | |
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short | |
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short --since='1 day ago' | |
git log --pretty=format:"%ad, %s%d [%an]" --graph --date=short --since='1 day ago' |