This file contains 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 cheatsheet for newbies | |
// init a new repo | |
git init | |
// add a "remote" with a name and repo url | |
git remote add "remoteName" "url" | |
// add all changes | |
git add -A |
This file contains 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
void function() { "use strict" | |
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WIP DO NOT USE WIP !!!!!!!!!!!!!!!!!!!!! | |
DO NOT USE THIS YET. | |
USE THE 2016 VERSION BELOW PLEASE. | |
WWWWWWWW WWWWWWWWIIIIIIIIIIPPPPPPPPPPPPPPPPP | |
W::::::W W::::::WI::::::::IP::::::::::::::::P | |
W::::::W W::::::WI::::::::IP::::::PPPPPP:::::P |
This file contains 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
window.__modules__ = {} | |
window.require = require | |
var modules = window.__modules__ | |
Promise | |
.resolve() | |
.then(get_snippets) | |
.then(deserialize) | |
.then(function(snippets){ |
This file contains 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
// I like to start projects with a harness, so here is an async and a non-async harness | |
// compatible* to the tape api so they are easily portable | |
// | |
// *theres just 2 methods I normally use but you can add as many as you like | |
// | |
function test(name, f){ | |
test.run = test.run || false | |
test.queue = test.queue || [] |
This file contains 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
// Stacks are LIFO , Last In First Out | |
// | |
class Stack { | |
constructor(){ | |
this.size = 0 | |
this.store = {} // array or object does not matter | |
} | |
push(item){ | |
this.store[this.size++] = item |
This file contains 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
// bind keyboard and gamepad buttons | |
ig.input.bind( ig.KEY.X, 'shoot1'); | |
ig.input.bind( ig.GAMEPAD1.FACE_1, 'shoot1'); | |
ig.input.bind( ig.GAMEPAD2.FACE_1, 'shoot2'); | |
ig.input.bind( ig.GAMEPAD3.FACE_1, 'shoot3'); | |
ig.input.bind( ig.GAMEPAD4.FACE_1, 'shoot4'); |
This file contains 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 Calculator () { | |
this._currentValue = 0; | |
this.commands = []; | |
} | |
Calculator.prototype = { | |
execute: function(command) { | |
this._currentValue = command.execute(this._currentValue); | |
this.commands.push(command); | |
}, |
This file contains 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
/** | |
* (Note: Depends on window.requestAnimationFrame for polling.) | |
* | |
* An experimental Gamepad object for detecting | |
* and parsing gamepad input. | |
* | |
* Current code borrows heavily from Marcin Wichary's work: | |
* http://www.html5rocks.com/en/tutorials/doodles/gamepad/ | |
* | |
* Also uses deadzone values from |
This file contains 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) { | |
// Vector Class ----------------------------------------------------------- | |
// ------------------------------------------------------------------------ | |
function Vector2(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
Vector2.prototype = { |
This file contains 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 { combineReducers } from 'redux'; | |
import users from './reducers/users'; | |
import posts from './reducers/posts'; | |
export default function createReducer(asyncReducers) { | |
return combineReducers({ | |
users, | |
posts, | |
...asyncReducers | |
}); |
OlderNewer