Skip to content

Instantly share code, notes, and snippets.

View soundyogi's full-sized avatar
🦊

KaiserMerkle soundyogi

🦊
View GitHub Profile
@soundyogi
soundyogi / gitCheatSheet
Last active June 6, 2017 18:00
Git Cheat Sheet
// 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
@soundyogi
soundyogi / 2018_chrome_snippet_gui_import_export.js
Last active December 24, 2023 22:09
A snippet to export and import your chrome snippets
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
@soundyogi
soundyogi / devtools_require_snippets.js
Last active August 21, 2019 11:42
Require your devtools snippets in your devtools snippets.
window.__modules__ = {}
window.require = require
var modules = window.__modules__
Promise
.resolve()
.then(get_snippets)
.then(deserialize)
.then(function(snippets){
@soundyogi
soundyogi / async_testing_harness_tape_api.js
Last active December 6, 2016 20:42
Vanilla JavaScript Test Harness Implementations for Fun and Profit. Never leave the house without one!
// 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 || []
@soundyogi
soundyogi / es6_stack_queue.js
Last active June 6, 2017 18:00
Stack,Queue
// 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
@soundyogi
soundyogi / example.js
Created January 13, 2017 16:38 — forked from zachstronaut/example.js
Support for 1 - 4 Gamepad Controllers in Impact.js for Local Multiplayer Games
// 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');
@soundyogi
soundyogi / command.js
Created January 18, 2017 01:39 — forked from sword-jin/command.js
JavaScript Command Pattern -- es5
function Calculator () {
this._currentValue = 0;
this.commands = [];
}
Calculator.prototype = {
execute: function(command) {
this._currentValue = command.execute(this._currentValue);
this.commands.push(command);
},
@soundyogi
soundyogi / Gamepad.js
Created January 20, 2017 17:12 — forked from videlais/Gamepad.js
Complete Gamepad.js code
/**
* (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
@soundyogi
soundyogi / box.js
Created January 22, 2017 14:10 — forked from BonsaiDen/box.js
Really simple AABB only physics engine.
(function(exports) {
// Vector Class -----------------------------------------------------------
// ------------------------------------------------------------------------
function Vector2(x, y) {
this.x = x;
this.y = y;
}
Vector2.prototype = {
@soundyogi
soundyogi / reducers.js
Created January 23, 2017 20:37 — forked from gaearon/reducers.js
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});