Skip to content

Instantly share code, notes, and snippets.

View overbalance's full-sized avatar

Jared Freeze overbalance

View GitHub Profile
@sunny
sunny / decay.js
Created September 30, 2008 09:05
// 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)
@nathansmith
nathansmith / module_pattern_init.js
Created January 11, 2010 17:08
Init + Module Pattern JS
// JS Module Pattern:
// http://j.mp/module-pattern
// Redefine: $, window, document, undefined.
var APP = (function($, window, document, undefined) {
// Automatically calls all functions in APP.init
$(document).ready(function() {
APP.go();
});
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@cowboy
cowboy / very-small-ie-detect.js
Created August 21, 2010 13:26 — forked from padolsey/gist:527683
Very small IE detect (aka type coersion ftw)
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 6) then:
// ie === 0
// If you're in IE (>=6) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@davatron5000
davatron5000 / videos.php
Created February 28, 2011 23:06
WordPress Custom Post Type Boilerplate (e.g. Videos)
<?php
/*
Plugin Name: Videos
Plugin URI:
Author: Dave Rupert
Author URI: http://www.daverupert.com
Description: A custom post type that adds videos and custom taxonomies.
Version: 1.0
*/
@adamesque
adamesque / config.ru
Created June 1, 2011 19:09
Password-protected Middleman via Rack/Heroku
require 'rubygems'
require 'middleman'
middleman_app = Middleman::Server.new
protected_middleman = Rack::Auth::Basic.new(middleman_app) do |username, password|
[username, password] == ['theuser', 'thepassword']
end
run protected_middleman
@doctyper
doctyper / _easings.scss
Created June 24, 2011 18:15
Ceaser Easings
$linear: cubic-bezier(0.250, 0.250, 0.750, 0.750) !default;
$ease: cubic-bezier(0.250, 0.100, 0.250, 1.000) !default;
$ease-in: cubic-bezier(0.420, 0.000, 1.000, 1.000) !default;
$ease-out: cubic-bezier(0.000, 0.000, 0.580, 1.000) !default;
$ease-in-out: cubic-bezier(0.420, 0.000, 0.580, 1.000) !default;
$ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530) !default;
$ease-out-quad: cubic-bezier(0.250, 0.460, 0.450, 0.940) !default;
$ease-in-out-quad: cubic-bezier(0.455, 0.030, 0.515, 0.955) !default;
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@jzazove
jzazove / gist:1479763
Created December 15, 2011 03:54
URL Friendly Javascript Regex
/* function to urlify a string */
var urlify = function(a){return a.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '')};
/* usage example */
var str_a = "* The Best Wallpaper Magazine in the . ? & world! : Rjer9238131 & ";
urlify(str_a)
/* returns */
"the-best-wallpaper-magazine-in-the-world-rjer9238131"
@adamesque
adamesque / adamluikart.zsh-theme
Created March 12, 2012 19:04
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%}"