Skip to content

Instantly share code, notes, and snippets.

@eternalruler
eternalruler / .gitconfig
Created January 21, 2016 22:56
Git alias to show all commits/branchs in map graph
[alias]
map = log --all --graph --decorate=short --color --format=format:'%C(bold blue)%h%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%x20%s%x20'
@eternalruler
eternalruler / .bashrc
Last active January 21, 2016 22:57
Custom Prompt String One for Git Repo Information
function git_num_untracked_files {
expr `git status --porcelain 2>/dev/null| grep "^??" | wc -l`
}
function git_num_staged_new_files {
expr `git status --porcelain 2>/dev/null| grep "^A" | wc -l`
}
function git_num_staged_modified_files {
expr `git status --porcelain 2>/dev/null| grep "^M" | wc -l`
}
function git_num_unstaged_files {
# initialization file (not found)
arr = [1,2,3,1,1,2,1,1]
class jump_path():
def __init__(self, target_array = None, spots = []):
#print('new path!')
self.target = target_array
self.spots = spots
def hops(self):
return len(self.spots)-1
def next_hops(self):
ezimmerman@qdidev:~$ cat test.py
class FooBar(object):
derp = 0
baz = 0
def __init__(self):
FooBar.derp += 1
self.derp += 1
self.baz += 1
@eternalruler
eternalruler / gist:9699826
Created March 22, 2014 01:34
Drawing random noise to HTML Canvas from Perlin Noise Generator using jQuery and Random.org
<html>
<body>
<!-- begin libraries -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
@eternalruler
eternalruler / gist:9699201
Created March 22, 2014 00:16
zz.util.keyboard
// create zz namespace
var zz = zz = zz || {};
// create zz.util namespace
zz.util = zz.util = zz.util || {};
// create zz.util.keyboard prototype
zz.util.keyboard = cc.Class.extend( /** @lends zz.util.keyboard# */ {
_keys: {},
/**
* Constructor
*/
@eternalruler
eternalruler / gist:9353244
Created March 4, 2014 19:01
JavaScript Stack Trace
function stackTrace() {
var err = new Error();
return err.stack;
}
@eternalruler
eternalruler / index.html
Created February 23, 2014 03:21
Auto-Resizing Search Bar
<!DOCTYPE>
<html>
<head>
<style>
input {
width:60px;
transition-duration:0.5s;
}
input:focus {
width:200px;
@eternalruler
eternalruler / gist:9129143
Last active August 29, 2015 13:56
Play Random Song on Grooveshark
/*
Add a random song to your Grooveshark playlist
Clears queue (not very fast) then adds the first song using a random songID that is valid
*/
(function() {
//clear current queue
function removeSong(cb) {
w = window.Grooveshark.setSongStatusCallback();
if (w && w.status != "none") {