Skip to content

Instantly share code, notes, and snippets.

View 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
PhantomJS JSON.parse() fails on array
View test.sh
$ 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 Sep 10, 2014
test your contacts against the gmail password compilation
View gmail-test.sh
#!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 Feb 26, 2015
node-hid-install-troubles
View gist:701c0b6fecfa8df870b4
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 Jan 18, 2012
code from my first visit to Dayton Clean Coders, an implementation of the kata at http://onestepback.org/vital_testing/
View implementation of TriangleClassifier
// 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 Feb 10, 2012
the Video.JS way of protecting console.* statements
View gist:1793873
_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 Feb 23, 2012
a simple jQuery based ticker
View gist:1895291
// 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 Feb 28, 2012
CoreMetrics Library Wrapper
View recordAnalytics.js
 /**
* 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 Mar 19, 2012
basic touch/mouse events + munging
View tounch_munge.js
// 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
View normalized.html
<!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>
You can’t perform that action at this time.