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
class Nav | |
def self.padded_selector(sel, max_len) | |
sel.ljust(max_len) | |
end | |
attr_accessor :id, :height, :items, :image | |
def initialize(attrs={}) | |
attrs.each { |k,v| send("#{k}=", v) } | |
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 ruby | |
Main { | |
description <<-txt | |
pimp3 is easily the greatest program ever written. if you can't figure | |
out what it does hook up some electrodes to your genitals and crank it | |
up fuckers! | |
txt | |
author 'ara.t.howard @ gmail.com' |
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
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
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/bash | |
# Unattended REE/Passenger installation | |
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/ | |
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys | |
if [ "$(whoami)" != "root" ]; then | |
echo "You need to be root to run this!" | |
exit 2 | |
fi | |
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
# http://www.jamesbritt.com/2007/12/18/sending-mail-through-gmail-with-ruby-s-net-smtp | |
# http://d.hatena.ne.jp/zorio/20060416 | |
require "openssl" | |
require "net/smtp" | |
Net::SMTP.class_eval do | |
private | |
def do_start(helodomain, user, secret, authtype) | |
raise IOError, 'SMTP session already started' if @started |
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
# This is for voting for the budgetsketch project on http://cinciinnovates.com | |
# You can vote daily. This stupid simple mechanize script will simply submit | |
# your vote. You still have to confirm the vote from your email inbox. I | |
# figure a cron job to submit my vote keeps me from forgetting to vote daily | |
# and I (as a human) am still confirming; so not cheating. YMMV | |
require 'rubygems' | |
require 'mechanize' | |
require 'pp' | |
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
wr () { ruby script/server webrick ${1:+--port $1} ; } | |
mr () { if [ -e log/mongrel.pid ]; then | |
echo do not wait for 'mongrel_rails restart' >/dev/null | |
mrs $1 $2 | |
fi | |
echo "== Starting Mongrel as daemon${1:+ for $1}${2:+ on port $2}" | | |
tee -a log/${1:-${RAILS_ENV:-development}}.log | |
mongrel_rails start --daemonize ${1:+-e $1} ${2:+-p $2} ; | |
i=1 | |
while [ $i -le 15 -a ! -e log/mongrel.pid ]; do |
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
wr () { ruby script/server webrick ${1:+--port $1} ; } | |
mr () { if [ -e log/mongrel.pid ]; then | |
echo do not wait for 'mongrel_rails restart' >/dev/null | |
mrs $1 $2 | |
fi | |
stubbornPID=$(sudo -p 'sudo password: ' lsof -n -P -t -i tcp:${1:-3000}) | |
if [ -n "${stubbornPID}" ]; then | |
echo Try to kill stubborn process with PID ${stubbornPID} | |
kill -s INT ${stubbornPID} | |
fi |
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/bash | |
echo "Setting up chef..." | |
sudo apt-get -y update | |
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert | |
cd /tmp | |
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz | |
tar zxf rubygems-1.3.4.tgz |
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 'webrick' | |
require 'webrick/httpproxy' | |
require 'fileutils' | |
require 'md5' | |
### | |
# FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb. | |
# The code that FakeWebRecorder generates should be suitable for testing | |
# interaction with a particular website. | |
# |
OlderNewer