Skip to content

Instantly share code, notes, and snippets.

View johnreilly's full-sized avatar

John Reilly johnreilly

View GitHub Profile
DEBUG: Executing ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml
DEBUG: ---- Begin output of ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: STDOUT:
DEBUG: STDERR:
DEBUG: ---- End output of ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: Ran ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml returned 0
DEBUG: Executing ln -nfs /data/my_trms_com/shared/config/database.yml /data/my_trms_com/releases/20090903185551/config/database.yml
DEBUG: ---- Begin output of ln -nfs /data/my_trms_com/shared/config/database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: STDOUT:
# Small bug in factory_girl running under rails 3 beta.
# Given a model:
class Thing < ActiveRecord::Base
# has a 'name' attribute
end
# These factory definitions work great.
Factory.define :thing do |thing|
thing.sequence(:name) { |n| "user#{n}" }
I'll throw a +1 in this as well. Here's the somewhat convoluted situation we have:
Anyone can send us emails at [email protected], and ZD tickets are created from that email. This works great.
We wrote a SSO app that takes advantage of ZD's remote authentication and API features. Our customers can sign up and
log into our site, and check the status of their tickets that were created from our site, or from emails they sent in.
This also works great.
But... I've seen several instances of customers signing up to our SSO app using one email address ([email protected]), and
then sending in email tickets from a different email address ([email protected]). From ZD's perspective, these are
# HTML5 style data-* attributes in haml
def test_html5_data_attributes
assert_equal("<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\n",
render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}"))
assert_equal("<div data-one_plus_one='2'></div>\n",
render("%div{:data => {:one_plus_one => 1+1}}"))
assert_equal("<div data-foo='Here&apos;s a \"quoteful\" string.'></div>\n",
render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}}))
# File: test_helper.rb
class ActiveSupport::TestCase
...
end
### Stub out post-processing on each class that uses paperclip
### (Uses an application configuration to turn on the slow processing again, if desired.)
if APP_CONFIG[:override_paperclip_processing]
[Canvas, Message, PictureAsset, User].each do |klass|
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
if ['solo', 'app', 'app_master'].include?(node[:instance_role])
run_for_app("your_app_name_here") do |app_name, data|
ey_cloud_report "delayed_job" do
#
# Cookbook Name:: nodejs
# Recipe:: default
#
if ['solo'].include?(node[:instance_role])
nodejs_file = "node-v0.1.101.tar.gz"
nodejs_dir = "node-v0.1.101"
nodejs_url = "http://nodejs.org/dist/#{nodejs_file}"
@johnreilly
johnreilly / SubViews.html
Created December 2, 2010 18:19
My attempt at using Backbone.js views to render other "sub-views"
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/underscore.js" type="text/javascript"></script>
<script src="js/backbone.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
['net/http', 'json'].each {|lib| require lib}; def payout bet; 13 == JSON.parse(Net::HTTP.get 'roulette.engineyard.com', '/')['winning_number'].to_i ? bet * 35 : 0; end
@johnreilly
johnreilly / gist:948724
Created April 29, 2011 18:02
Mount rails app in rack cascade
#This is psudocode, but should be an okay example...
# Step 1: require rails' environment
require 'path/to/config/environment'
# Step 2: add rails app to cascade:
run Rack::Cascade.new([
rack_app1,
MyRailsApp::Application, # Place rails in the cascade where you need it