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
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32 | |
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null' | |
def quiet( &block ) | |
io = [STDOUT.dup, STDERR.dup] | |
STDOUT.reopen DEV_NULL | |
STDERR.reopen DEV_NULL | |
block.call | |
ensure |
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
def quiet( &block ) | |
io = STDOUT.dup | |
STDOUT.reopen '/dev/null', 'w' | |
block.call | |
STDOUT.reopen io | |
end | |
quiet { puts "hello" } | |
quiet { puts "hello" } # take this out and it works | |
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
# Package generated configuration file | |
# See the sshd(8) manpage for details | |
# What ports, IPs and protocols we listen for | |
Port 22 | |
# Use these options to restrict which interfaces/protocols sshd will bind to | |
#ListenAddress :: | |
#ListenAddress 0.0.0.0 | |
Protocol 2 | |
# HostKeys for protocol version 2 |
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
# credits | |
# http://github.com/hartcode/serverjuice/ | |
# http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu | |
# http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html | |
# upgrade packages | |
apt-get update | |
apt-get upgrade | |
# install reasonably easy-to-use text editor (skip this if you can wield something greater) |
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
property numFFWindows : 0 | |
property FFPos : {} | |
property FFSize : {} | |
property numTermWindows : 0 | |
property TermPos : {} | |
property TermSize : {} | |
property iTunesPos : {} | |
property iTunesSize : {} | |
property EmacsPos : {} | |
property EmacsSize : {} |
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 |
OlderNewer