Skip to content

Instantly share code, notes, and snippets.

@code
code / woot.txt
Created July 22, 2008 13:40
Just a little test.
Love this.
How do I tell it that I want this to be ruby?
@code
code / tab_view.html.haml
Created July 31, 2008 04:59
Adding a simple tab view, nothing fancy just easy.
-# File: application.html.haml
-# Include YUI in your head
=yui_loader_includes
-# File: _tab_view.html.haml
-# To use a component in one of your views, call yui_require
-# Components are loaded using the yui loader, dependencies are managed
-# Any code added to yui_script filter will be rolled into single init function and outputted with the loader
# File: ec2_bundle.rb
# Author: Luke Hubbard
# Gist: http://gist.github.com/gists/8770
# License: MIT
# Desc: Simple script to bundle and upload an EC2 instance
require 'open-uri'
# Helpers
def read(file)
# File: robot.rb
# Author: Luke Hubbard
# Gist: http://gist.github.com/gists/18289
# License: MIT
# Description: Ruby version of robot to solve Google Treasure Hunt.
def robot(rows, cols)
matrix = Array.new(rows).collect{ Array.new(cols) }
x, y = rows-1, cols-1
x.downto(0) do |row|
# File: c_version_robot.rb
# Author: Luke Hubbard
# Gist: http://gist.github.com/gists/18325
# License: MIT
# Description: C version of the robot for Google Treasure Hunt.
# Bugs: Cant handle big grids, numbers too big.
require 'rubygems'
require 'inline'
@code
code / swf.rb
Created October 29, 2008 17:30
# File: swf.rb
# Author: Luke Hubbard
# Gist: http://gist.github.com/20755
# License: MIT
# NOTE THIS HAS NOW BEEN REPLACE BY
# http://github.com/code/swf_object_helper
# SWFObject Embed Helper - Easy swf embed using SWFObject and ruby magic
#
# File: password_generator.rb
# Author: Luke Hubbard
# Gist: http://gist.github.com/21812
# License: MIT
require 'digest'
class PasswordGenerator
CHARS = (('a'..'z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0)
SIZE = 9
export TZ="Europe/London"
export LD_LIBRARY_PATH="$HOME/.packages/lib"
export PATH="$HOME/.packages/bin:$HOME/.gems/bin:${PATH}"
export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
EDITOR="/usr/bin/nano -w"
export PS1="\\[\\e]0;\\w\\a\\]\\n\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\\$ "
export LS_COLORS="no=00:fi=00:di=01;36:ln=01;35:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:"
export LSCOLORS='GxFxcxdxCxegedabagacad'
# GENERAL
alias df='df -h'
alias du='du -h'
alias grep='grep --color'
require 'rubygems'
require 'open-uri'
require 'json'
# Twitter search in one line, got to love ruby.
def twitter_search(q); JSON.parse(open("http://search.twitter.com/search.json?q=#{q}").read) end
# puts twitter_search("codegent").inspect