Skip to content

Instantly share code, notes, and snippets.

View andrewle's full-sized avatar

Andrew Le andrewle

View GitHub Profile
# 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"
# 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
@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 = {
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 / 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

@andrewle
andrewle / gist:636574
Created October 20, 2010 14:54
IE/Navigator Flashback
<html>
<script>
function IsNewBrowser()
{
var isIE = navigator.appName.indexOf("Microsoft") != -1;
var isNav = navigator.appName.search(/Netscape/i) != -1;
var ver = parseInt(navigator.appVersion);
if(isIE || (isNav && ver >=5) )
return true ;
return false ;
" Lifted from http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
" and cleaned up alignment for for easy reference. Posted here so I can find
" this easily. //Andrew Le
" Generated from c:/pdsrc/xterm-222/256colres.h by allcolors.pl
" Xterm can display text in 256 colors, but it is hard to determine what all
" those colors are. So below is a list of the approximate names for the 256
" default colors in xterm. You can put it in your vimrc or just use it as a
" reference when in doubt.