Skip to content

Instantly share code, notes, and snippets.

this is the police

Mike Taylor miketaylr

this is the police
Block or report user

Report or block miketaylr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pre-commit
# pre-commit hook to prevent html5 video or audio files from being checked
# into the repo. because large binary files in a git repo sucks. bad.
media_files=$(git diff --cached --name-only --diff-filter=ACR | \
egrep -i '\.(webm|mp4|ogg|mp3|ogv|m4v|avi|vp8|mov|oga|mp1|mp2|mpeg|3gp|wav)$')
if [[ "$media_files" ]]; then
echo 'Commit failed. Are you trying to check in media files into the repo?'
View utmstrip.user.js
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
View how_people_really_use_the_ternary.js
function benchmark(method, times, name){
var startTime = (new Date()).getTime(), endTime;
endTime = (new Date()).getTime();
console.log(name, endTime - startTime);
var x = 1, y = 0;
View detect IE and version number through injected conditional comments.js
//detect Internet Explorer and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check)
//version arg is for IE version (optional)
//comparison arg supports 'lte', 'gte', etc (optional)
var isIE = (function(undefined){
var doc = document,
doc_elem = doc.documentElement,
cache = {},
View html5-data.js
(function (undefined) {
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
var forEach = [].forEach,
regex = /^data-(.+)/,
el = document.createElement('div'),
mutationSupported = false,
View gist:360287
if (!window.localStorage || !window.sessionStorage) (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
expires = "; expires="+date.toGMTString();
View gist:301921
// Assumes jQ 1.4+
function preload(file) {
return jQuery('<link/>', {
href: file,
rel: 'stylesheet',
media: 'print',
load: function() {
This script updates to Chromium nightly. You can run it manually, but I run it using cron.
If you run it using cron remember that it _will quit_ your running Chromium so make sure you have it set to save tabs if you want them.
In order to install it with cron run:
crontab -e
Add the line:
View gist:296521
// original (
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
View provide_html5.js
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
You can’t perform that action at this time.