Skip to content

Instantly share code, notes, and snippets.

View andrewle's full-sized avatar

Andrew Le andrewle

View GitHub Profile
# 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 \
#
# 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
#!/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
#
@andrewle
andrewle / spacescroller.lua
Created April 13, 2010 03:40
Simple spaceship scroller game demo in Lua with the Love game engine
function love.load()
config = {
initial_x = 200,
initial_y = 400,
step = 500,
numStars = 100,
starSpeedFactor = 1
}
spaceship = {
@andrewle
andrewle / center_window.sh
Created April 19, 2010 06:37
Center the top most window using AppleScript
#!/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
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
#!/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
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__);
@andrewle
andrewle / capture.rb
Created July 27, 2010 21:08
Get full screen shots of a list of webpages using webkit2png.py
#!/usr/bin/env ruby
PROJECT_NAME = ""
pages = %w{
... urls to pages go here
}
pages.each_with_index do |url, index|
system("python webkit2png.py -W 1200 -o #{PROJECT_NAME}_#{index} -F #{url}")
@andrewle
andrewle / projects.md
Created September 11, 2010 08:59
List of Current Projects

Productivity List

This is a list of things that I'm working on. All the projects that I want to spend more time doing that I work on depending on my mood the quality of time that I currently have.

Inspired by tips from Aaron Swartz at http://www.aaronsw.com/weblog/productivity

The Projects