Skip to content

Instantly share code, notes, and snippets.

Change this:
$(function() {
$.scrollDepth();
});
To this:
jQuery(function() {
jQuery.scrollDepth();
if (window.Notification) {
Notification.requestPermission(function() {
setTimeout(function(){
var n = new Notification('News Alert', {
'body' : 'S&P Surpasses 2000'
});
n.onclick = function() {
location.href = 'http://';
@robflaherty
robflaherty / gist:5388589
Created April 15, 2013 14:39
data attribute initializing boilerplate
(function($, window, undefined) {
"use strict";
var Plugin = function(element, options) {
this.element = element;
this.$element = $(element);
this.init();
};
@robflaherty
robflaherty / gist:2430219
Created April 20, 2012 16:42
sudo PATH stuff
sudo env PATH=$PATH dowhatever
Example:
sudo env PATH=$PATH npm uninstall -g less
@robflaherty
robflaherty / squish.py
Created March 17, 2012 16:03
Optipng and Jpegtran image optimization script
#!/usr/bin/env python2.6
import sys, os, fnmatch, subprocess
image_dir = ''.join(sys.argv[1:])
optipng = '/usr/bin/optipng'
jpegtran = '/usr/local/bin/jpegtran'
pngs = jpgs = []
pngs_size = jpgs_size = pngs_size_new = jpgs_size_new = 0
@robflaherty
robflaherty / watch_less.sh
Created February 4, 2012 15:43
Simple LESS watch and compile script
#!/bin/bash
# Requires watchr: https://github.com/mynyml/watchr
watchr -e 'watch(".*\.less$") { |f| system("lessc #{f[0]} > #{f[0]}.css && echo \"#{f[0]} > #{f[0]}.css\" ") }'
@robflaherty
robflaherty / svg-path-to-json.py
Created January 15, 2012 16:39
Extract SVG paths and convert to JSON for use with Raphael.js
from xml.dom import minidom
import json
config = {
'svg_file' : 'map.svg',
'js_file' : 'map.js',
'js_var' : 'svgMap'
}
svg = minidom.parse(config['svg_file'])
@robflaherty
robflaherty / gist:1609508
Created January 14, 2012 00:19
ack-sed recursive find/replace
ack -l --print0 "/_asset/" | xargs -0 -n 1 sed -i -e 's/_asset/_assets/g'
@robflaherty
robflaherty / pump-up-the-font.js
Created December 11, 2011 16:37
WordPress fullscreen mode type enhancing bookmarklet
/*
* WordPress offers a wonderful minimalist fullscreen editing mode but the text is too small for my taste. You can use this bookmarklet
* to pump up the font-size and line-height to something more pleasurable.
*/
javascript:(function(){
var iframe = document.getElementById('wp_mce_fullscreen_ifr'),
tinymce = iframe.contentWindow.document.getElementById('tinymce');
tinymce.style.fontSize = '18px';
@robflaherty
robflaherty / gist:1348477
Created November 8, 2011 17:35
IE styles copying to clipboard

In IE8 and IE9, copy/pasting into Microsoft Word produces different results depending on the order of the class names specified in the HTML. In the first case, the display: none declaration is copied to the Clipboard; in the second case it is omitted.

JSFiddle: http://jsfiddle.net/sBthg/4/

Thoughts?