Skip to content

Instantly share code, notes, and snippets.

@autumn-hoerr
autumn-hoerr / create_webpages.command
Created August 3, 2012 14:15 — forked from jasmarc/create_webpages.command
Creates a photo gallery from a folder full of images, somewhat per this request: http://www.idiotking.org/archives/2012/05/exercise-in-futility/
# save as "Rakefile" in desired directory
# cd to directory and type "rake"
task :default => 'make_html'
desc "Turns a directory of images into linked HTML"
task :make_html do
extensions = "png,PNG,jpg,JPG,gif"
working_dir =File.dirname(__FILE__)
pictures = Dir.glob("#{working_dir}/*.{#{extensions}}")
@autumn-hoerr
autumn-hoerr / throttle.js
Created July 10, 2012 14:09
throttle window resize event
//from http://stackoverflow.com/questions/5489946/jquery-how-to-wait-for-the-end-or-resize-event-and-only-than-perform-action
$(window).resize(function(){
rtime = new Date();
if(timeout === false){
timeout = true;
setTimeout(resizeend, delta);
}
});
@autumn-hoerr
autumn-hoerr / rps.rb
Created June 13, 2012 21:12
Rock, Paper, Scissors
class Game
attr_accessor :possible_choices, :victory_table, :score, :round
def initialize
@victory_table = {
'rock' => 'paper',
'paper' => 'scissors',
'scissors' => 'rock'
}
@possible_choices = [:rock, :paper, :scissors]