This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function preload(arrayOfImages) { | |
$(arrayOfImages).each(function(){ | |
// Find 4 digit pixel reference in filename | |
var digits = 4; | |
var str = this; | |
var regex = new RegExp("\\d{"+digits+"}", "g"); | |
var match = str.match(regex); | |
// If bg image is smaller than user's screen width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
PS1='\[\e[1;34m\]@\[\e[m\] \[\e[0;32m\]:\W\[\e[m\]\[\e[1;32m\] \[\033[1;31m\]$(parse_git_branch)\[\033[01;34m\] \$\[\e[m\] \[\e[1;37m\]' | |
PATH="/opt/local/bin:$PATH" | |
alias ls="ls -G" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'base64' | |
# Decoding functions | |
def base64_url_decode str | |
encoded_str = str.gsub('-','+').gsub('_','/') | |
encoded_str += '=' while !(encoded_str.size % 4).zero? | |
Base64.decode64(encoded_str) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date_started = Date.parse("2011-08-09") | |
date_now = Date.today | |
@by_day = [] | |
@days_passed = date_now.mjd - date_started.mjd | |
(1..@days_passed).each do |day| | |
date = Kit.where(:created_at.gte => day.days.ago, :created_at.lte => (day-1).days.ago).fields(:created_at).first | |
count = Kit.count(:created_at.gte => day.days.ago, :created_at.lte => (day-1).days.ago) | |
@by_day.push("date" => date.created_at.strftime("%m/%d"), "count" => count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.new_image(images, uid) | |
final = Magick::Image.new(1000, 600).matte_reset! | |
last = images.length - 1 | |
images.each_with_index do |image, index| | |
o = image[1] | |
n = Magick::Image.read($dir+'/'+o[:src]).first | |
n.scale!(200, o[:height].to_i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function build() { | |
var images = []; | |
$('.image').each(function() { | |
var position = $(this).data('isotope-item-position'), | |
img = $(this).find('img'), | |
src = $(img).attr('src'), | |
w = $(img).width(), | |
h = $(img).height(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias html5='wget --no-check-certificate http://github.com/h5bp/html5-boilerplate/zipball/v3.0stripped ./; mv ./v3.0stripped ./boilerplate.zip; unzip boilerplate.zip; mv h5bp-html5-boilerplate-*/* .; rm -rf ./boilerplate.zip; rm -rf ./h5bp-html5-*;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:( | |
function() { | |
var s = prompt('Enter the number you want to send to.', '15035363309'); | |
if ( s != null && s != '' ) { | |
var req = new XMLHttpRequest(); | |
var u = 'http://phonehome-app.heroku.com/sms/send/'+s+'?url='+encodeURIComponent(window.location.href); | |
req.open('GET', u, false); | |
req.send(null); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); | |
if (mobile) { | |
// DROPKICK | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getJSON('https://graph.facebook.com/me/likes?access_token='+response.authResponse.accessToken+'&callback=?', function(d) { | |
console.log(d.data); | |
}); |
OlderNewer