Skip to content

Instantly share code, notes, and snippets.

var buggyAndroid = parseInt((/android (\d+)/.exec(window.navigator.userAgent.toLowerCase()) || [])[1], 10) < 4;
if (!history.pushState || buggyAndroid) {
if (window.location.hash) {
if(window.location.pathname !== '/') window.location.replace('/#!' + window.location.hash.substr(2)); //Hash and a path, just keep the hash (redirect)
} else {
window.location.replace('/#!' + window.location.pathname); //No hash, take path
}
}
//And then in app.config:
@bsparks
bsparks / starfield.js
Created April 9, 2013 16:11
ImpactJS Starfield
// starfield.js
ig.module(
'game.starfield'
)
.requires(
'impact.system',
'impact.background-map'
)
.defines(function() {
var colors = ['#fff', '#555', '#f8ceda'];
/*
Pig Latin interpreter
by Ben Buckman, July 20 2012
Rules:
- All words beginning with a consonant have their first letter moved to the end of word followed by 'ay'.
Example: Hello -> Ellohay
- All words beginning with a vowel have their first letter moved to the end moved to the word followed by 'hay'.
Example: Another -> Notherahay

Privacy Policy

What information do we collect?

This application does not collect any personal information.

Internet access is only used to retrieve ads from the web.

Contacting Us

@bsparks
bsparks / ShellCtxMenu.reg
Created February 12, 2013 15:27
windows registry hack to add 'open command prompt here'
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
@="Open Command Prompt Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
@="cmd.exe /k pushd %L"
@bsparks
bsparks / nts.js
Created July 10, 2012 22:43
start of my node.js multi svn tool
#!/usr/bin/env node
var _ = require("lodash"),
util = require('util'),
spawn = require('child_process').spawn,
fs = require("fs"),
p = require("path"),
ansi = require("ansi"),
cursor = ansi(process.stdout),
program = require("commander"),
@bsparks
bsparks / jquery_click.sublime-snippet
Created June 11, 2012 19:02
jquery_click.sublime-snippet
<snippet>
<content><![CDATA[
\$(${1:selector}).click(function(e) {
e.preventDefault();
e.stopPropagation();
${2://handler}
});
]]></content>
<tabTrigger>click</tabTrigger>
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 11,
"translate_tabs_to_spaces": true,
"draw_white_space": "all",
"trim_trailing_white_space_on_save": true,
"ignored_packages":
[
"Vintage"
]
@bsparks
bsparks / LICENSE.txt
Created December 5, 2011 23:58 — forked from jed/LICENSE.txt
publish/subscribe, or pubsub
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bsparks
bsparks / LICENSE.txt
Created December 5, 2011 23:45 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE