Skip to content

Instantly share code, notes, and snippets.

Avatar
🌱
just noodlin'

Max Krieger maxkrieger

🌱
just noodlin'
View GitHub Profile
@maxkrieger
maxkrieger / ThinAirHash.js
Last active Aug 29, 2015
Make a hash out of thin air!
View ThinAirHash.js
/*
>>>>>>>>>>>>>>>>>
ThinAirHash
>>>>>>>>>>>>>>>>>
use:
makeHash(length);
returns:
random hash consisting of up/lowercase letters and numbers 0-9
@maxkrieger
maxkrieger / DateArr.js
Created May 31, 2014
Get a handy Date() array!
View DateArr.js
// returns: [day, month, year]
function dateArr(){
var cDate = new Date();
var cArr = [];
cArr.push(cDate.getDate());
cArr.push(cDate.getMonth());
cArr.push(cDate.getYear());
return cArr;
}
@maxkrieger
maxkrieger / findBy.js
Created Dec 15, 2014
associative arrays made easy.
View findBy.js
/*
findBy: associative arrays made easy.
Usage:
var myArr = [{id: "foo"}, {id: "bar"}];
var result = findBy(myArr, "id", "foo"); //returns {id: "foo"}
*/
var findBy = function(arr, identifier, name) {
for (var i = 0; i < arr.length; i++) {
if (arr[i][identifier] == name) {
View glhf.js
// GL HF Translator (or gf hl or hg lf? :D)
function translate(str){
var translation = "";
for(var i=0; i<str.length; i++){
switch(str.charAt(i)){
case "g":
translation += "good ";
break;
case "l":
@maxkrieger
maxkrieger / AmazingKeyboardListener.js
Last active Dec 23, 2015
Amazing™ Active Keyboard Listener "great for games!"
View AmazingKeyboardListener.js
// (raf shim by Paul Irish)
window.requestAnimationFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
@maxkrieger
maxkrieger / install-node.sh
Created Sep 25, 2013
Installs a fresh node.js!
View install-node.sh
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@maxkrieger
maxkrieger / piglatin.js
Created Sep 28, 2013
A piglatin function :D
View piglatin.js
function pigLatin(pig){
var pigArr = pig.split("");
var firstLetter = pigArr.splice(0, 1);
pigArr.push(firstLetter + "ay");
var result = "";
for(var i=0; i<pigArr.length; i++){
result += pigArr[i];
}
return result;
}
@maxkrieger
maxkrieger / s.js
Last active Dec 24, 2015
A localStorage library of epic proportions ;)
View s.js
/*
SJS, a localStorage library of epic proportions.
usage:
saving:
s.set("myKey", myObject);
retrieving:
s.get("myKey");
returns myObject
*/
@maxkrieger
maxkrieger / earth.json
Created Oct 13, 2013
A PixelEdited Earth
View earth.json
{
"colors": ["#009933", "#000099"],
"pxmap": [
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1],
[-1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1],
View keybase.md

Keybase proof

I hereby claim:

  • I am maxkrieger on github.
  • I am maxkrieger (https://keybase.io/maxkrieger) on keybase.
  • I have a public key ASBmhMoFtnuFWmRAFUEnhp43mfasgPswXND1iB05VqEGAAo

To claim this, I am signing this object: