Skip to content

Instantly share code, notes, and snippets.

View technicalpickles's full-sized avatar

Josh Nichols technicalpickles

View GitHub Profile
# Note, this is vlad:
set :application, 'flockup'
set :domain, "[email protected]"
set :deploy_to, "/home/deploy/apps/flockup"
set :repository, "[email protected]:railsrumble/the-presidential-vampire-league.git"
# set :revision, "origin/production"
set :revision, "origin/railsrumble"
set :use_sudo, false
set :mongrel_command, '/opt/ruby-enterprise-1.8.6-20080810/bin/mongrel_rails'
>> f = Flock.find('cocaine')
=> #<Flock id: 10, name: "cocaine", description: "Cocaine coke blow Barry white", created_at: "2008-10-20 00:06:46", updated_at: "2008-10-20 00:06:46">
>> f.destroy
NameError: undefined local variable or method `flock' for #<Flock:0x93ea5e0>
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/attribute_methods.rb:256:in `method_missing'
from /home/deploy/apps/flockup/releases/20081019235620/app/models/flock.rb:27:in `notify_removed'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/callbacks.rb:173:in `send'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/callbacks.rb:173:in `evaluate_method'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/callbacks.rb:161:in `call'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/g
def update
update_successful = @owner.update_attributes(params[:owner])
@address = @owner.address
update_successful &&= @address.update_attributes(params[:address])
@security_challenge = @owner.security_challenge
update_successful &&= @security_challenge.update_attributes(params[:security_challenge])
unless params[:photo].blank? or params[:photo][:uploaded_data].blank?
@technicalpickles
technicalpickles / flocks_controller.rb
Created October 26, 2008 21:28
flocks controller and controller test from flockup.com
class FlocksController < ApplicationController
resources_controller_for :flocks, :only => [:index, :new, :create]
def index
self.resources = find_resources
end
def new
self.resource = new_resource
end
$ jeweler technicalpickles the-perfect-gem
$ cd the-perfect-gem/
/Users/nichoj/Projects/the-perfect-gem
$ git push origin master
Counting objects: 11, done.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 2.01 KiB, done.
Total 11 (delta 0), reused 0 (delta 0)
To [email protected]:technicalpickles/the-perfect-gem.git
* [new branch] master -> master
diff --git a/lib/amazon.rb b/lib/amazon.rb
index f22cea7..c8b28e0 100644
--- a/lib/amazon.rb
+++ b/lib/amazon.rb
@@ -1 +1 @@
-require File.dirname(__FILE__) + "/amazon/ecs"
\ No newline at end of file
+require 'amazon/ecs'
\ No newline at end of file
diff --git a/test/test_helper.rb b/test/test_helper.rb
/opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activeresource-2.1.2/lib/active_resource/base.rb:339:in `prefix': undefined method `path' for nil:NilClass (NoMethodError)
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activeresource-2.1.2/lib/active_resource/base.rb:427:in `collection_path'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activeresource-2.1.2/lib/active_resource/base.rb:562:in `find_every'
from /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/activeresource-2.1.2/lib/active_resource/base.rb:507:in `find'
from test.rb:9
require 'rubygems'
require 'httparty'
class LighthouseParty
attr_accessor :account, :token
include HTTParty::ClassMethods
def initialize(account, token)
self.account = account
self.token = token
>> start_date = period.first
=> Sat, 01 Nov 2008 00:00:00 EDT -04:00
>> end_date = period[1]
=> Sun, 30 Nov 2008 23:59:59 EST -05:00
>> start_date.upto(end_date, 1.day) {|t| puts t}
2008-11-01 00:00:00 -0400
2008-11-02 00:00:00 -0400
2008-11-03 00:00:00 -0500
2008-11-04 00:00:00 -0500
2008-11-05 00:00:00 -0500
def upto(max, interval=1.day)
t = self
while t <= max
yield t
# breakpoint
next_t = t + interval
if next_t.utc_offset < t.utc_offset
next_t += 1.hour.to_i
elsif next_t.utc_offset > t.utc_offset
next_t -= 1.hour.to_i