(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
// Stateful is a simple implementation of the state pattern for javascript. | |
// | |
// Read more on this design pattern here: | |
// -> http://sourcemaking.com/design_patterns/state | |
// | |
// Initialize Stateful by passing it an object, the name of the initial state | |
// (defaults to "default"), and an optional hash of interfaces that will be | |
// applied for each state. If these interfaces are not passed, they default to | |
// the object's constructor's States property. So, for example: | |
// |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
var now = | |
typeof performance !== 'undefined' && | |
typeof performance.now === 'function' ? | |
function () { | |
return performance.now(); | |
} : | |
typeof Date.now === 'function' ? | |
function () { | |
return Date.now(); | |
} : |
/** | |
* Creates a new class with the given field names as arguments and | |
* properties. Allows `instanceof` checks with returned constructor. | |
*/ | |
var createClass = function () { | |
var length = arguments.length; | |
var args = new Array(length); | |
var i; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Gist</title> | |
</head> | |
<body> | |
<div id="app"></div> |
var waiting = []; | |
var waitingID; | |
var callWaiting = function () { | |
var funcs = waiting; | |
waiting = []; | |
waitingID = 0; | |
while(funcs.length) { |
var noop = function () {}; | |
var once = function (func) { | |
return function () { | |
if (func === null) { | |
return; | |
} | |
var callFunc = func; |
var hasOwn = Object.prototype.hasOwnProperty; | |
var extend = function () { | |
var target = {}; | |
var i; | |
for (i = 0; i < arguments.length; i++) { | |
var source = arguments[i]; | |
var prop; |
/** | |
* Solve this puzzle by writing the shortest code. | |
* Whitespaces (spaces, new lines, tabs...) are counted in the total amount of chars. | |
* These comments should be burnt after reading! | |
**/ | |
var inputs = readline().split(' '); | |
var LX = parseInt(inputs[0]); // the X position of the light of power | |
var LY = parseInt(inputs[1]); // the Y position of the light of power |