Skip to content

Instantly share code, notes, and snippets.

View fairchild's full-sized avatar

Michael Fairchild fairchild

  • Procore
  • California
View GitHub Profile
@fairchild
fairchild / gist:18334
Created October 21, 2008 15:55
sequel versioning
class Ticket < Sequel::Model
set_schema do
foreign_key :ticket_version_id, :table => :ticket_version
end
is(:versioned_fact, {:dimensions => [TicketVersion]})
one_to_many :ticket_versions
end
class TicketVersion < Sequel::Model
set_schema do
#Query LH for ticket, and update db cache. Allow ticket number or lh ticket object
def self.update_or_create_from_lighthouse(ticket, project_id)
lh_ticket = case ticket.class
when Fixnum: Ticket.retrieve_from_lh(ticket, project_id)
when Lighthouse::Ticket: Ticket.retrieve_from_lh(ticket.number, project_id)
else return false
end
if lh_ticket == 404 #delete ticket if it was deleted from LH
#!/bin/sh
# VHostit
# Simple bash script to add a virtual host to apache & your hosts file on OS X
#
# Installation
# Throw vhostit.sh somewhere in your path. I like to copy it to /usr/local/bin/vhostit
# Usage
# `vhostit domain.tld` from within the directory you want to host.
# The domain.tld will be added to your hosts file and a VirtualHost added to your apache's httpd.conf\
class Spec::Example::ExampleGroup
def execute(*args, &block)
# DB = Merb::Orms::Sequel.connect
Merb::Orms::Sequel.connect.transaction do
super(*args, &block)
raise Sequel::Error::Rollback
end
end
end
ticket = Array.new
puts "$$ #{ticket.class}"
tick = case ticket.class
when Fixnum: 'Im a number'
when Array: "im an array"
else 'ELSE'
end
puts tick
@fairchild
fairchild / gist:21182
Created October 30, 2008 23:46 — forked from bakkdoor/file.rb
f = File.new("myfile.txt", "r") # open a file with read-mode
# ... do some stuff with the file, like read its content, ouput it on the screen or whatever
# finally: close it!
f.close
# or:
@fairchild
fairchild / gist:22435
Created November 5, 2008 21:34
Basic poolparty spec
# Basic poolparty template
pool :cloudcompute do
instances 2..3
cloud :app do
access_key ENV['AWS_ACCESS_KEY_ID'] || 'your_aws_key_id'
secret_access_key ENV['AWS_SECRET_ACCESS_KEY'] || 'your_aws_secret_key'
ami "ami-1cd73375"
end
................................................................................................................................./opt/local/lib/ruby/gems/1.8/gems/logging-0.9.4/lib/logging.rb:200: warning: already initialized constant MAX_LEVEL_LENGTH
........
Pending:
Resource wrapped command global resources setting grabbing after already instantiated should grab the resource when called in in a block (Not Yet Implemented)
Called from ./spec/poolparty/pool/resource_spec.rb:362
Finished in 7.662247 seconds
1168 examples, 0 failures, 1 pending
Last login: Thu Nov 6 20:22:02 on ttys001
Hi
mate .tahoe:~
> mate .profile
tahoe:~
> mate /tmp/
.s.PGSQL.5432 aprFz850m launch-4OxnAy/ mysql.sock
.s.PGSQL.5432.lock aprcRNwgD launch-W48pgE/ passenger_status.15.fifo
.webdavUDS.7IOsib com.hp.launchport launch-yRcAvL/ ssh-X0LnAAuaKA/
.webdavcache.232.FPWZ9D/ hsperfdata_fairchild/ launchd-143.gQzeWM/ ssh-b4OU5AwWSD/
PoolParty handles the dirty work for you.
PoolParty uses git-style commands to give you full-power of communication with your cloud in realtime!
TO->
PoolParty handles the dirty work for you. Communicate with your cloud with Git-style commands in realtime!