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
/* | |
* Here is an implementation of an NPM module I recently wrote, done with ES6 classes. | |
* Is it a "betrayal" of the prototypal nature of JavaScript to use classes? Come on. | |
* Classes are a very common design pattern that's easy to implement with prototypes. | |
* And for some use cases, they're a good fit. Node's EventEmitter abstraction is a | |
* perfectly reasonable use of classes and inheritance: it's an abstract datatype that's | |
* user-extensible. So the 'events' module provides a base class with some built-in | |
* functionality that you can extend. | |
* | |
* And yes, it's a "class." Just check the docs: |
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
// ==UserScript== | |
// @name Use Markdown, sometimes, in your HTML. | |
// @author Paul Irish <http://paulirish.com/> | |
// @link http://git.io/data-markdown | |
// @match * | |
// ==/UserScript== | |
// If you're not using this as a userscript just delete from this line up. It's cool, homey. |
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' |
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
// 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
#!/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
/** | |
* 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
// 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
// | |
// 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
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) { |