Skip to content

Instantly share code, notes, and snippets.

View bananatron's full-sized avatar
🍞
Stale bread is just lofi toast.

Spenser X bananatron

🍞
Stale bread is just lofi toast.
View GitHub Profile
“A history lesson for people who think that history doesn’t matter:
What’s the big deal about railroad tracks?
The US standard railroad gauge (distance between the rails) is 4 feet, 8.5 inches. That’s an exceedingly odd number.
Why was that gauge used?
Well, because that’s the way they built them in England, and English engineers designed the first US railroads.
Why did the English build them like that?
@bananatron
bananatron / random_hex.js
Created April 26, 2017 01:12
Get Random Hex
'#'+Math.floor(Math.random()*16777215).toString(16);
@bananatron
bananatron / get_url_params.js
Last active March 20, 2017 19:08
Get URL Params
// Get URL PARAMS
var getUrlParam = function(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));