Skip to content

Instantly share code, notes, and snippets.

View TheNeuralBit's full-sized avatar
🐢

Brian Hulette TheNeuralBit

🐢
View GitHub Profile
@TheNeuralBit
TheNeuralBit / objects_are_dumb.js
Created April 20, 2016 18:12
Convenience function for iterating through keys and values of a JS Object
// obj.forEach(function(k, v) { ... });
Object.prototype.forEach = function forEach(callback) {
for (var key in this) {
if (this.hasOwnProperty(key)) {
callback(key, this[key]);
}
}
}

Keybase proof

I hereby claim:

  • I am theneuralbit on github.
  • I am hulettbh (https://keybase.io/hulettbh) on keybase.
  • I have a public key whose fingerprint is 2BBC 7636 3D31 D1CC 5131 45C0 2F48 7FAD BB75 17BE

To claim this, I am signing this object:

@TheNeuralBit
TheNeuralBit / index.html
Last active February 12, 2016 15:26
Animate a random Lissajous Curve
<html>
<body>
<svg></svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js"></script>
<script>
var lineData = d3.range(1000);
function get_rand() {
return Math.round(Math.random()*9 + 0.5);
}
@TheNeuralBit
TheNeuralBit / inotifyexec.sh
Created August 9, 2014 14:44
A simple script using inotify to execute a command whenever a file is modified
#! /bin/bash
while [ 1 ]; do
inotifywait ${2}
${1} ${2}
done
@TheNeuralBit
TheNeuralBit / break80.py
Created January 15, 2014 01:47
Simple script for taking a file with a bunch of long lines and breaking it into 80 character lines - I use it to fix the output of http://fuckyeahmarkdown.com
import sys
infile = open(sys.argv[1], 'r')
outfile = open(sys.argv[2], 'w')
for line in infile.read().split('\n'):
while len(line) > 80:
idx = line[:80].rfind(' ')
outfile.write('%s\n' % line[:idx])
line = line[idx + 1:]