Skip to content

Instantly share code, notes, and snippets.

View overbalance's full-sized avatar

Jared Freeze overbalance

View GitHub Profile
@overbalance
overbalance / Rakefile
Created June 2, 2011 21:17
Middleman Rake Tasks
require 'rubygems'
desc "Completely empty /build"
task :clobber do
sh "rm -rf build/* build/.[Dh]*"
end
desc "Export compiled build"
task :build do
sh "mm-build"
@overbalance
overbalance / gist:1383929
Created November 21, 2011 21:05
placeholder placeholder
if (!Modernizr.input.placeholder){
$('input[placeholder],textarea[placeholder]').each(function(){
var input = $(this);
if (!input.attr('placeholder')) return;
var ph = input.attr('placeholder');
input.val(ph);
input.focus(function(){
if (input.val() == ph) input.val('');
});
@overbalance
overbalance / adamluikart.zsh-theme
Created August 21, 2012 17:24 — forked from adamesque/adamluikart.zsh-theme
My totally awesome oh-my-zsh theme.
local user_host='%{$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$fg[yellow]%} %~%{$reset_color%}'
local git_branch='$(git_prompt_info)%{$reset_color%}'
PROMPT="
${user_host}${current_dir} ${git_branch}
⑆ "
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
// relies on Date.now() which has been supported everywhere modern for years.
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
(function(window) {
// prepare base perf object
if ("performance" in window) {} else {
window.performance = {};
}
if ("now" in window.performance) {} else {
var nowOffset = Date.now();
if ("timing" in window.performance && "navigationStart" in window.performance.timing) {
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence : Improved by brunoais
(function(win, doc) {
if (win.addEventListener) {
return;
}
//No need to polyfill
function docHijack(p) {
var old = doc[p];
doc[p] = function(v) {
return addListen(old(v));
@overbalance
overbalance / decay.js
Created October 15, 2013 20:23 — forked from sunny/decay.js
// Decay class, to call a callback less and less often. For example,
// make an Ajax request and freshen the decay only if the request has changed.
//
// To start the timeouts, call decay_object.start()
// To freshen up the speed of query, call decay_object.reset()
//
// Options:
// - seconds: time between each callback at the start and after a reset() (default 2)
// - decay: multiplier to use after each callback call (default 1.3)
// - max: maximum number of seconds to wait between each call (default 42)
/*
* HTML Parser By John Resig (ejohn.org)
* Original code by Erik Arvidsson, Mozilla Public License
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
*
* // Use like so:
* HTMLParser(htmlString, {
* start: function(tag, attrs, unary) {},
* end: function(tag) {},
* chars: function(text) {},
if (!document.querySelectorAll) {
document.querySelectorAll = function (selectors) {
var style = document.createElement('style'), elements = [], element;
document.documentElement.firstChild.appendChild(style);
document._qsa = [];
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}';
window.scrollBy(0, 0);
style.parentNode.removeChild(style);