Skip to content

Instantly share code, notes, and snippets.

View deathbob's full-sized avatar

Bob Larrick deathbob

View GitHub Profile
What is a gist? I dunno but maybe it's like a blog.
Getting rspec set up for my latest project here at INM United. The following applies only to a brand new project, not an upgrade or retrofitting of rspec. Altho it may apply to them too, I just don't know.
required reading -
http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/
gem install rspec
gem install rspec-rails
to generate the rspec stuff, cd to your project directory and
Holy fuck is getting a has_one to work with nested forms a pain in the dick.
useful links if you're working on this http://www.pixellatedvisions.com/2009/03/18/rails-2-3-nested-model-forms-and-nil-new-record
and especially
#
Michał Czyż – February 14, 2009 @ 02:23 PM
i’ve got this same problem, like you Gastón Ramos, when i write something like this:
#example with a formatted date and a boolean
xml.instruct!
xml.declare! :DOCTYPE, :plist, :PUBLIC, "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
xml.plist("version" => 1.0) do |plist|
plist.dict do |wrapper|
@occasions.each do |occasion|
wrapper.key occasion.id
wrapper.dict do |dict|
dict.key 'ccd_remote_id' # required id from the system of record (rails db in this case)
---- config/initializers/to_plist.rb
require 'rails_extensions/plist'
ActiveRecord::Base.class_eval do
include Plist
end
master>rake import:users
(in /Users/bob/src/ffe)
user system total real
Faster 22.100000 1.100000 23.200000 ( 23.217951)
CSV 371.860000 8.340000 380.200000 (380.484987)
...
master>rake import:users
(in /Users/bob/src/ffe)
require 'active_support'
DEPLOY_CONFIG = YAML::load(File.open("config/deploy.yml"))
default_run_options[:pty] = true
#
# General Deployment settings
#
set :application, DEPLOY_CONFIG['application']
set :repository, DEPLOY_CONFIG['repository'] || 'master'
set :scm, :git
master>git config remote.github.url
[email protected]:inmunited/Hawaii-Guide-Me.git
master>git pull github master
remote: error: Could not read 94840ee0cf77c1aaf5fa286b0abc717081cf87ba
remote: fatal: revision walk setup failed
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header
webmin@rors:/data/lva/current$ bundle check
The Gemfile's dependencies are satisfied
webmin@rors:/data/lva/current$ bundle show
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.0.beta4)
* actionpack (3.0.0.beta4)
* activemodel (3.0.0.beta4)
* activerecord (3.0.0.beta4)
* activeresource (3.0.0.beta4)
001:0> mail = User.find(2).send_token_email
SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
User Columns (150.9ms) SHOW FIELDS FROM `users`
User Load (0.4ms) SELECT * FROM `users` WHERE (`users`.`id` = 2)
#<TMail::Mail port=#<TMail::StringPort:id=0x82964f74> bodyport=#<TMail::StringPort:id=0x82962850>>
002:0> mail.body
"<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#0000">\n <tr>\n <td align="center">\n <table id="Table_01" width="660" border="0" cellpadding="0" cellspacing="0">\n <tr>\n <td height="160">\n <img src="http://media.cambio.com.s3.amazonaws.com/email/mailer-sliced_02.png" width="660" height="160" alt="Insider Access to the new Cambio">\n </td>\n </tr>\n <tr>\n <td height="197">\n <a href="http://localhost:3000/users/fIyeVcsCM6G5qgymJHAa/complete_profile">Follow Me</a><a href="http://beta.cambio.com/"><img src="http://media.cambio.com.s3.amazonaws.com/email/mailer-sliced_04.png" width="660" height="197" a
master>cap staging deploy
* executing `staging'
* executing `deploy'
triggering before callbacks for `deploy'
* executing `deploy:notify:start'
* executing "curl -X POST -d \"application=mrteeth\" http://weather.engineyard.com/`hostname`/deploy_start -fs"
servers: ["72.46.233.55"]
[72.46.233.55:7000] executing command
command finished
Warning: We couldn't notify EY of your deploy, but don't worry, everything is fine