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
irb(main):001:0> require 'models' | |
=> true | |
irb(main):002:0> DataMapper.setup(:default, "sqlite3://test.sqlite3") | |
=> #<DataMapper::Adapters::Sqlite3Adapter:0x2b3089430d48 @name=:default, @field_naming_convention=DataMapper::NamingConventions::Underscored, @resource_naming_convention=DataMapper::NamingConventions::UnderscoredAndPluralized, @uri=#<Addressable::URI:0x159844a14108 URI:sqlite3://test.sqlite3>, @transactions={}> | |
irb(main):003:0> DataMapper.auto_migrate! | |
Segmentation fault |
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 | |
#-- | |
# Name : git_watch.rb | |
# Author : Jerod Santo | |
# Contact : "moc.liamg@otnas.dorej".reverse | |
# Date : 2008 October 14 | |
# About : Checks a git repository for changes and emails provided email | |
# address if changes have been made. Schedule with cron. | |
#-- | |
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
30 12 * * * ruby /tmp/vote_for_github.rb |
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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain | |
class ApplicationController < ActionController::Base |
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 'rubygems' | |
require 'benchmark' | |
gem = ARGV.shift.strip rescue '' | |
if gem == '' | |
STDERR.puts "usage: #{$0} [gem]" | |
exit 1 | |
end | |
`free` |
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 | |
unless ARGV.length == 1 | |
puts "Usage: #{__FILE__} [file to convert]" | |
exit | |
end | |
original_file = ARGV.first | |
sans_extension = original_file.gsub(/\.flv$/,"") | |
system "ffmpeg -i #{original_file} -b 192K #{sans_extension}.mp3" |
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
ruby -i -pe '$_.gsub!("etch","lenny")' /etc/apt/sources.lst |
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/local/bin/ruby | |
require 'resolv' | |
require 'rubygems' | |
require 'rb-skypemac' | |
include SkypeMac | |
def set_location(loc) | |
Skype.send_ :command => "SET PROFILE MOOD_TEXT #{loc}" | |
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
require 'ping' | |
unless ARGV.first =~ /\d+\.\d+\.\d+\.\d+/ | |
puts "Bad Network address: #{ARGV.first}" | |
exit 1 | |
end | |
$stdout = File.open(ARGV.last,"w") if ARGV.size == 2 | |
class_c = ARGV.first.gsub(/\d+$/,"") |
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 Pickup < ActiveRecord::Base | |
validate_on_create :date_three_days_in_future | |
private | |
def date_three_days_in_future | |
errors.add_to_base "must be at least 3 days from now" unless date >= 3.days.from_now.to_date | |
end | |
end |
OlderNewer