Skip to content

Instantly share code, notes, and snippets.

@weisjohn
weisjohn / keybase.md
Created March 27, 2014 12:31
keybase.md

Keybase proof

I hereby claim:

  • I am weisjohn on github.
  • I am weisjohn (https://keybase.io/weisjohn) on keybase.
  • I have a public key whose fingerprint is 1499 7B49 6AD9 35B2 AF3D 2780 A5B1 A295 C05D CF30

To claim this, I am signing this object:

@weisjohn
weisjohn / test.sh
Created May 15, 2014 14:36
PhantomJS JSON.parse() fails on array
$ phantomjs
phantomjs> a = '[{"foo":"bar"},{"foo":"cat"}]'
"[{\"foo\":\"bar\"},{\"foo\":\"cat\"}]"
phantomjs> JSON.parse(a)
{
"0": {
"foo": "bar"
},
"1": {
@weisjohn
weisjohn / gmail-test.sh
Created September 10, 2014 22:04
test your contacts against the gmail password compilation
#!bin/bash
echo "Export your Gmail contacts as a CSV, name it contacts.csv, put it in this directory, press Enter"
read foo
wget --referer=https://forum.btcsec.com https://forum.btcsec.com/uploads/manual_09_2014/google_5000000.7z
echo "I haven't worked out a way to unzip .7z files from a cli yet... patches welcome"
echo "Press enter when you've unzipped the file"
read foo
@weisjohn
weisjohn / gist:701c0b6fecfa8df870b4
Created February 26, 2015 22:47
node-hid-install-troubles
0 info it worked if it ends with ok
1 verbose cli [ '/Users/jweis/.nvm/v0.12.0/bin/node',
1 verbose cli '/Users/jweis/.nvm/v0.12.0/bin/npm',
1 verbose cli 'install' ]
2 info using npm@2.5.1
3 info using node@v0.12.0
4 verbose install where, deps [ '/Users/jweis/mysrc/weisjohn/nes-controller', [ 'node-hid' ] ]
5 verbose install where, peers [ '/Users/jweis/mysrc/weisjohn/nes-controller', [] ]
6 info preinstall nes-controller@0.1.0
7 silly cache add args [ 'node-hid@~0.3.2', null ]
@weisjohn
weisjohn / implementation of TriangleClassifier
Created January 18, 2012 16:49
code from my first visit to Dayton Clean Coders, an implementation of the kata at http://onestepback.org/vital_testing/
// implementation of the challenge found here: http://onestepback.org/vital_testing/
var TriangleClassifier = {
valid : function (args) {
var sides = [ args[0], args[1], args[2] ];
if (args.length != 3) {
return false;
@weisjohn
weisjohn / gist:1793873
Created February 10, 2012 23:09
the Video.JS way of protecting console.* statements
_V_.log = function() {
_V_.log.history = _V_.log.history || [];
_V_.log.history.push(arguments);
if (window.console) {
arguments.callee = arguments.callee.caller;
var newarr = [].slice.call(arguments);
(typeof console.log === "object" ? _V_.log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr))
}
};
(function(b) {
@weisjohn
weisjohn / gist:1895291
Created February 23, 2012 22:01
a simple jQuery based ticker
// a simple utility function for pretty printing
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
}
@weisjohn
weisjohn / recordAnalytics.js
Created February 28, 2012 18:35
CoreMetrics Library Wrapper
 /**
* recordAnalytics( {
* 'cm': {
* 'pageid': 'your/tag/here', // required
* 'searchstring': 'your search string', // optional
* 'categoryid': 'your_category_id' // optional
* 'type' : 'type of tag' // optional
* },
* });
*
@weisjohn
weisjohn / tounch_munge.js
Created March 19, 2012 14:42
basic touch/mouse events + munging
// feature detection
isTouch = "ontouchstart" in window;
InputHandler = {
startEventType : isTouch ? "touchstart" : "mousedown",
moveEventType : isTouch ? "touchmove" : "mousemove",
endEventType : isTouch ? "touchend" : "mouseup",
isTouchDevice : isTouch,
// normalize an event object generated by a select
@weisjohn
weisjohn / normalized.html
Created May 21, 2012 07:21 — forked from scottkellum/normalized.html
pixel normalization
<!doctype html>
<html>
<head>
<!-- Encoding -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>