Skip to content

Instantly share code, notes, and snippets.

View uberbrady's full-sized avatar

Brady Wetherington uberbrady

View GitHub Profile
@uberbrady
uberbrady / gist:1344608
Created November 7, 2011 10:15 — forked from buzzedword/gist:1317242
Add indexOf to all IE versions under IE9
<!--[if lt IE 9]> -->
<script>
/* if (!Array.prototype.indexOf) { */
Array.prototype.schmindexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
@uberbrady
uberbrady / gist:5888788
Last active December 19, 2015 03:18
Get rid of stupid, weird, annoying audio autoplay on Huffington Post.
sudo -s 'echo "127.0.0.1 avideos.5min.com fw.5min.com pthumbnails.5min.com embed.5min.com syn.5min.com" >>/etc/hosts'
@uberbrady
uberbrady / after_hooks.js
Last active December 21, 2015 05:39
Very sloppy first stab at node-phantom support for cucumber tests. Requires a *binary* install of phantom-js that is in your PATH, and requires the npm "node-phantom" (npm install node-phantom)
// features/support/after_hooks.js
var myAfterHooks = function () {
this.After(function(callback) {
// Again, "this" is set to the World instance the scenario just finished
// playing with.
// We can then do some cleansing:
//this.emptyDatabase(); //shut down some web server things?
@uberbrady
uberbrady / gist:7390790
Created November 9, 2013 22:16
How to turn on cross-zone load-balancing for AWS ELB's
# to update the Python version of your AWS CLI client
sudo easy_install -U awscli
# to actually modify your ELB's to use cross-zone load-balancing:
aws elb modify-load-balancer-attributes --load-balancer-name MYLBNAME --load-balancer-attributes '{ "CrossZoneLoadBalancing": { "Enabled": true } }'
@uberbrady
uberbrady / gist:7712487
Last active December 29, 2015 18:39
What I *ACTUALLY* was trying to say...
$valid_statuses=Array("RTD","Deployable","Whatever","Blah");
if(!in_array($_GET['status'],$valid_statuses)) {
some_kind_of_error();
} else {
do_query(Array("param"=> "param", "status" => $_GET['status']));
}
@uberbrady
uberbrady / patch.sh
Last active August 29, 2015 13:56
How to apply the patch
# Grab the patch from:
# http://www.sektioneins.de/en/blog/14-02-22-Apple-SSL-BUG.html
cd /System/Library/Frameworks/Security.framework/Versions/A
sudo cp Security Security.bkup
# should respond with 'Password:' - put in your password
sudo bspatch Security.bkup Security ~/Downloads/APPLE_SSL_SECURITY_FRAMEWORK_QUICK_AND_DIRTY_64BIT_FIX.bspatch
# should again respond with 'Password:' - put in your password one more time
@uberbrady
uberbrady / keybase.md
Created March 24, 2014 16:36
Keybase.io proof for me

Keybase proof

I hereby claim:

  • I am uberbrady on github.
  • I am uberbrady (https://keybase.io/uberbrady) on keybase.
  • I have a public key whose fingerprint is F821 8137 1F8F 6AB2 011C 477B 5856 374F D6BE EDDC

To claim this, I am signing this object:

@uberbrady
uberbrady / search.js
Created April 13, 2014 22:31
Some tweaks to Oliver Caldwell's excellent binary search Javascript function
binaryIndexOf=function (searchElement) {
'use strict';
var minIndex = 0;
var maxIndex = this.length - 1;
var currentIndex;
var currentElement;
console.warn("WE ARE LOOKING FOR: ",searchElement,"AKA",+searchElement);
@uberbrady
uberbrady / gist:dd12f2f2d8e9fe5a0e6d
Last active August 29, 2015 14:01
First the "wrong" way then the "right" way, and how that can get out of hand.
class Person
def age
Date.now-birthyear
end
end
test "That a person has an age" do
p=Person.new 1974
travel_to 2014
assert(p.age==40)
@uberbrady
uberbrady / gist:5da2f4fffeff00ac23fa
Created August 20, 2014 02:51
fpm-caused ofe error?
Error: Cannot find module './build/Release/ofe.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/ofe/ofe.js:1:78)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)