This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When 'I create a new comment' do | |
steps %Q{ | |
When I enter comment text | |
And I press "Add Comment" | |
} | |
end | |
When 'I enter comment text' do | |
@comment = Factory :comment, :section => @section, :user => @me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
respond_to do |format| | |
format.json do | |
if @my_model.save! | |
render :json => @my_model.to_json(:methods => [:owner_name]) #owner_name is a method that returns owner.display_name | |
end | |
end | |
format html do | |
if @my_model.save! | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
respond_to do |format| | |
if @comment.save! | |
format.json do | |
... | |
end | |
format.html do | |
... | |
end | |
else | |
format.json do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ Poopin'd Status Screenshot ] | |
If your status reads like this, with you none-the-wiser, consider yourself Poopin'd. You have been initiated into a trend so prevalent it's got an [official set of rules]. | |
Under normal circumstances, the lifecycle of a Poopin' involves you turning a blind eye to your cell phone for thirty seconds, a keenly aware and diabolical friend, and subsequent social media dignity losses. Statistically speaking, considering that there are approximately 5,000,000,000 cellphones globally. That's a potential of quite a bit of Poopin'. | |
But think about this, more people across the globe have access to cell phones than have access to clean toilets. | |
Preventable diseases caused by a lack of basic sanitation kill more people each year than AIDS, malaria, and the measles combined. Toilet humor is only funny when you've got one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sampling process 4786 for 3 seconds with 1 millisecond of run time between samples | |
Sampling completed, processing symbols... | |
Analysis of sampling Cloud (pid 4786) every 1 millisecond | |
Process: Cloud [4786] | |
Path: /Applications/Cloud.app/Contents/MacOS/Cloud | |
Load Address: 0x100000000 | |
Identifier: com.linebreak.CloudApp | |
Version: 0.9 (0.9) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [109] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr1 = [1,2,3] | |
,arr2 = [2,3,4] | |
,arr3 = [3,4,5]; | |
function overloadIntersection() { | |
var cached = _.intersection; | |
_.intersection = function() { | |
var rest = arguments, arr = []; | |
if(rest.length == 0) { | |
throw "You must pass at least one array to _.intersection." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Schema, which wraps Mongoose's Schema for pretty and extendable models. | |
var _ = require('underscore') | |
, each = require('each') | |
, mongoose = require('mongoose') | |
, Schema = function(obj) { | |
this.schema = new mongoose.Schema(obj) | |
this.references = [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: Error running command deploy | |
error: Nodejitsu Error (500): Internal Server Error | |
error: There was an error while attempting to deploy the app | |
error: | |
error: Rackspace Error (404): Item not found | |
error: Error output from Haibu: | |
error: | |
error: Error: Rackspace Error (404): Item not found | |
error: at Request._callback (/root/haibu-orchestra/node_modules/haibu/node_modules/cloudfiles/lib/cloudfiles/common.js:184:18) | |
error: at Request.init.self.callback (/root/haibu-orchestra/node_modules/haibu/node_modules/request/main.js:119:22) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!Array.prototype.unique) { | |
Object.defineProperty(Array.prototype, "unique", { | |
value: function(key) { | |
var o = {}, i, l = this.length, r = [] | |
for(i=0; i<l;i+=1) { | |
if(key) { | |
var _key = "" | |
,self = this | |
if(typeof key == "string") { | |
_key = key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!Array.prototype.indexOf) | |
{ | |
Array.prototype.indexOf = function(elt /*, from*/) | |
{ | |
var len = this.length >>> 0; | |
var from = Number(arguments[1]) || 0; | |
from = (from < 0) | |
? Math.ceil(from) | |
: Math.floor(from); |