( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
( Source: the mongoid cheatsheet )
class User
include Mongoid::Document
var urls = ["http://bit.ly/", | |
"http://tinyurl.com/", | |
"http://is.gd/", | |
"http://tr.im/", | |
"http://ow.ly/", | |
"http://cli.gs/", | |
"http://u.mavrev.com/", | |
"http://twurl.nl/", | |
"http://tiny.cc/", | |
"http://digg.com/", |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
Testing OAuth Apis in rails 3.x apps
Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.
The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.
#!/bin/bash | |
set -exo pipefail | |
BUILD_ENV=$1 | |
if [ `uname` == 'Darwin' ]; then | |
OSX=1 | |
JSCOMPRESSOR="yuicompressor --type js" | |
else | |
OSX= |
Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.
I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).
These are my opinions. Read this document through and pick up the good parts to your preferences.
THIS IS A WORK IN PROGRESS USING THE YOSEMITE BETA - DO NOT RELY ON IT!
Install OSX on a fresh drive. I recommend using Disk Utility to repartition the entire drive as 1 partition, as this clears any hidden volumes.
Once the initial install is complete, the OSX Setup Assistant will create your first adminstrator account.
Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.
This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.
You are encouraged to fork this and modify it to your heart's content to match your own needs.