Skip to content

Instantly share code, notes, and snippets.

describe UsersController do
describe "handling GET /users.xml" do
before(:each) do
@users = mock("Array of Users", :to_xml => "XML")
User.stub!(:find).and_return(@users)
end
def do_get
@request.env["HTTP_ACCEPT"] = "application/xml"
get :index
#Core Libs
sudo apt-get install curl tcsh git-core scons g++
sudo apt-get install libpcre++-dev libboost-dev libmozjs-dev
#Spiderpig (Oh wait, Spidermonkey)
curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
tar zxvf js-1.7.0.tar.gz
cd js/src
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
make -f Makefile.ref
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
script/plugin install git://github.com/purzelrakete/workling.git
gem sources -a http://gems.github.com/
sudo gem install starling-starling
sudo mkdir /var/spool/starling
sudo ln -s /opt/ruby-enterprise/bin/starling /usr/bin/starling
sudo starling -d -p 22122
starling -v
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
before_create :my_cool_thing
def my_cool_thing
p Time.now
end
#Remove existing node.js
cd ~/node-previously-installed
./configure
make uninstall
#Installation without using sudo
#IIRC, this only works for shell windows opened
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
@jonathanclarke
jonathanclarke / gist:848224
Created February 28, 2011 22:59
Regenerate thumbnails for has_many paperclip
has_attached_file :file,
:styles => { :thumb => "139x107#", :thumb_ems => "64x64#", :thumb_aar => "100x100#", :thumb_newsletter => "80x60#", :thumb_newsletter_product => "110x85#", :web_image => "145x>" },
:storage => :s3,
:bucket => "domain.com_#{RAILS_ENV}",
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => ":class/:id/:style/:filename"
RAILS_ENV=staging rake paperclip:refresh:thumbnails CLASS=Asset
@jonathanclarke
jonathanclarke / daily_deal_rss_feed
Created August 8, 2011 09:20 — forked from davemorro/daily_deal_rss_feed
Recommended Daily Deal RSS Feed
<?xml version="1.0" encoding="UTF-8" ?>
<deals>
<deal>
<title>A perfect daily deal feed for just $17.50</title>
<link>http://www.dailydealsite/deals/1</link>
<guid>http://www.dailydealsite/deals/1</guid>
<description><![CDATA[Set your daily deal site up for maximum distribution effectiveness. Many deal sites include HTML within the description however, we recommend you remove all formatting, enabling the aggregator to more easily integrate your information. If you do include HTML, be sure wrap the description in CDATA sequences.]]></description>
<highlights><![CDATA[Usually a list of the deal highlights. Like the description, you should wrap the highlights in CDATA sequences.]]></highlights>
<image>http://www.dailydealsite.com/images/image.jpg</image>
<price>17.50</price>