Skip to content

Instantly share code, notes, and snippets.

View trak3r's full-sized avatar

Thomas "Teflon Ted" Davis trak3r

View GitHub Profile
ted@ceylon /usr/bin »ls -al | grep -i ruby
lrwxr-xr-x 1 root wheel 75 May 21 05:31 erb -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/erb
lrwxr-xr-x 1 root wheel 71 May 21 05:31 gem -> ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem
lrwxr-xr-x 1 root wheel 75 May 21 05:31 irb -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/irb
-rwxr-xr-x 1 root wheel 435 Jul 4 08:14 multiruby
-rwxr-xr-x 1 root wheel 441 Jul 4 08:14 multiruby_setup
lrwxr-xr-x 1 root wheel 76 May 21 05:31 rdoc -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/rdoc
lrwxr-xr-x 1 root wheel 74 May 21 05:31 ri -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ri
lrwxr-xr-x 1 root wheel 71 Jul 8 22:13 ruby -> /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
-rwxr-xr-x 1 root w
@trak3r
trak3r / gist:143618
Created July 9, 2009 12:34
all my gems with versions
*** LOCAL GEMS ***
actionmailer (2.3.2, 1.3.6)
actionpack (2.3.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.2, 1.15.6)
activeresource (2.3.2)
activesupport (2.3.2, 1.4.4)
acts_as_ferret (0.4.4, 0.4.1)
autotest-fsevent (0.1.1)
@trak3r
trak3r / gist:144114
Created July 10, 2009 00:05
thread bug in capistrano
# threads = Array(servers).map { |server| establish_connection_to(server, failed_servers) }
# threads.each { |t| t.join }
Array(servers).each { |server| safely_establish_connection_to(server, Thread.current, failed_servers) }
@trak3r
trak3r / gist:147115
Created July 14, 2009 19:08
remove minutes/seconds from time
class Time
def no_minutes
return self - self.min.minutes - self.sec.seconds
end
end
@trak3r
trak3r / gist:154271
Created July 24, 2009 14:13
big honking sql join
# Note: Schema is legacy (not my design!)
class WidgetSummary < ActiveRecord::Base
class << self
def for_factory_by_part_between(factory, start_date, end_date)
start_hour = Hour.after(start_date)
end_hour = Hour.before(end_date)
find_by_sql <<-SQL
select WidgetSummary.*
from WidgetSummary
inner join Widget
http://forums.atlassian.com/thread.jspa?messageID=257299176&tstart=0
1. Change the Base SDK in the Xcode Project to "Simulator - iPhone OS 2.2"
2. Change the Code Signing Identity to "Don't Code Sign"
# dump table with data
# to be called by migration prior to potentially-dangerous operation
class ActiveRecord::Migration
def self.backup_table(table)
filename = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{self.to_s}_#{table}.sql"
STDERR.puts "Backing up table #{table} to #{filename}"
@connections ||= YAML::load(ERB.new(IO.read("#{RAILS_ROOT}/config/database.yml")).result)
connection = @connections[RAILS_ENV]
parameters = []
(parameters << "-u #{connection['username']}") if connection['username']
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
tell application "Terminal"
activate
do script with command "cd ~/my/development/directory"
do script with command "cd ~/my/development/directory; mate ."
do script with command "cd ~/my/development/directory; script/server"
do script with command "cd ~/my/development/directory; script/console"
do script with command "cd ~/my/development/directory; autotest"
end tell
ted@teds-laptop:~$ ruby -v
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt-get install ruby
bash: ruby: command not found
ted@teds-laptop:~$ sudo apt-get install ruby
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package ruby