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
define('START_TIME', microtime(true)); | |
function benchmark($class, $function, $line) | |
{ | |
error_log("dt => {$class}->{$function}:{$line} at: " . (microtime(true) - START_TIME) . " seconds."); | |
} | |
//Call by doing: | |
benchmark(__CLASS__, __FUNCTION__, __LINE__); |
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
#!/usr/bin/env ruby | |
# | |
# This tag doesn't work: div.span-3col.column | |
# | |
full_line = STDIN.read | |
raw_tag = if full_line.strip.match(/\s/) | |
full_line.strip.reverse.match(/^.*?\s/).to_s.reverse.strip | |
else | |
full_line.strip.reverse.match(/^.*?\s?$/).to_s.reverse.strip | |
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
require 'rubygems' | |
require 'closure-compiler' | |
desc "Use the Closure Compiler to compress Tumbletag.js" | |
task :build do | |
js = File.open('tumbletag.js', 'r') | |
min = Closure::Compiler.new.compile(js) | |
File.open('tumbletag.min.js', 'w') {|f| f.write(min) } | |
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
#!/usr/bin/env bash | |
# Center the top most window using AppleScript | |
# I call this up quickly using Quicksilver and run it as a terminal | |
# script because (surprise!) it's faster than running as native AppleScript | |
osascript -e " | |
tell application \"Finder\" | |
set screenSize to bounds of window of desktop | |
set screenWidth to item 3 of screenSize | |
end tell |
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 love.load() | |
config = { | |
initial_x = 200, | |
initial_y = 400, | |
step = 500, | |
numStars = 100, | |
starSpeedFactor = 1 | |
} | |
spaceship = { |
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
#!/bin/sh | |
# Textmate command that uses AppleScript to switch to Firefox, reload | |
# the browser, and then switch back to Textmate | |
# I have this bound to Ctl-Opt-Command R | |
# | |
# Save: Nothing (or Current File is useful too) | |
# Input: None | |
# Output: Discard | |
# |
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
# | |
# Implementation of Justin.TV's Namespace API for creating and playing application | |
# channels. In it's current form the application will dynamically allocate new | |
# Justin.TV channels for the sake of connecting two people together in a chat/date | |
# format. | |
# @author WinkVid | |
# @source http://sourceforge.net/projects/winkvid/ | |
# | |
from django.views.generic.simple import direct_to_template |
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
# For compiling PHP 5.2.11 on Mac OS X Leopard 10.5.8 | |
# | |
# Configure PHP | |
./configure \ | |
--prefix=/usr \ | |
--mandir=/usr/share/man \ | |
--infodir=/usr/share/info \ | |
--disable-dependency-tracking \ | |
--with-apxs2=/usr/sbin/apxs \ |
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
# A rough and dirty baseline Rails app template | |
# I just discovered this feature and love it | |
remove_files = [ | |
"public/index.html", | |
"public/images/rails.png", | |
"public/javascripts/controls.js", | |
"public/javascripts/dragdrop.js", | |
"public/javascripts/effects.js", | |
"public/javascripts/prototype.js" |
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
#!/usr/bin/env bash | |
# | |
# Ignored .svn directories | |
# Also ignored .DS_Store files from Mac file system | |
# Add the --dry-run argument if you want to just test it first | |
DOMAIN="phototourwebsites@phototourwebsites.com" | |
DIR="/home/phototourwebsites/www/phototoursmls/idx_dev_andrew" | |
rsync -avz \ |