This file contains hidden or 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
Love this. | |
How do I tell it that I want this to be ruby? |
This file contains hidden or 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
-# 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 | |
This file contains hidden or 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
# 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) |
This file contains hidden or 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
# 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| |
This file contains hidden or 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
# 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' | |
This file contains hidden or 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
# 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 | |
# |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# File: dreamhost_adapter.rb | |
# Author: Luke Hubbard | |
# Gist: http://gist.github.com/gists/21814 | |
# License: MIT | |
require 'rubygems' | |
require 'mechanize' | |
require 'logger' | |
# Need to monkey patch the CookieJar so it accepts SSL cookies! |
This file contains hidden or 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
# File: kuler.rb | |
# Author: Luke Hubbard | |
# Gist: http://gist.github.com/21838 | |
# License: MIT | |
# Description: Little API wrapper for Kuler, Adobe's color site. http://kuler.adobe.com. Not you need an api key! | |
require 'rubygems' | |
require 'active_support' | |
require 'syndication/rss' | |
require 'open-uri' |
This file contains hidden or 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
class Fixnum | |
def even? | |
num = self | |
stack = [1] | |
while(stack.last < num) | |
stack.push(stack.last*2) | |
end | |
while(num > 1) | |
val = stack.pop |
OlderNewer