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
Some basic features and scenarios for authentication. Implementation left out. Sorry. | |
Feature: Signing up for an account | |
In order to use the site | |
As a visitor | |
I sign up for an account | |
Scenario: | |
Given I'm an anonymous visitor | |
And I go to the home page |
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
#!/usr/env ruby | |
require 'rubygems' | |
require 'fileutils' | |
class Object | |
def empty? | |
return true if self.nil? | |
case | |
when String, Array, Hash | |
return true if self.length == 0 |
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
module FindOrCreate | |
def self.included(base) | |
base.class_eval do | |
extend ClassMethods | |
end | |
end | |
module ClassMethods | |
def find_or_create(arg) | |
first(arg) || create(arg) |
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
require "mongo_mapper" | |
MongoMapper.database = 'test' | |
module FindOrCreate | |
def self.included(base) | |
base.class_eval do | |
extend ClassMethods | |
end | |
end |
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
# This may well be user error, but CoffeeScript: | |
ubb_text: ubb_text.replace /\[img\](.+?)\[\/img\]/gi, (str, args...) -> | |
throw "oh, crap!" unless args[0] | |
image_url: if args[0].match(/^http/i) then args[0] else "http://www1.istockphoto.com${args[0]}" | |
"<img src=\"${image_url}\" />" | |
# The resultant js is: | |
ubb_text = ubb_text.replace(/\[img\](.+?)\[\/img\]/gi, function(str) { |
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
# HTML Tag class | |
# | |
# Purpose: Programmatically generate HTML so you aren't scotch-taping | |
# strings together all the time. | |
# | |
# Usage: targetString = Tag.make(tagName, attributeHash, text) | |
# | |
# Where: targetString: is what you will eventually inject into the DOM -- the HTML | |
# tagName: is the actual tag name (i.e., "tr" or "input") | |
# attributeHash: is the set of tag attributes, for example -- |
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
$ sudo brew install node | |
Password: | |
Formula already installed: /usr/local/Cellar/node/0.2.2 | |
steve-rosss-iMac-2:~ sxross$ sudo brew uninstall node | |
Uninstalling /usr/local/Cellar/node/0.2.2... | |
steve-rosss-iMac-2:~ sxross$ sudo brew install node | |
==> Downloading http://nodejs.org/dist/node-v0.2.2.tar.gz | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/node/0.2.2 | |
==> make install |
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
$ brew install coffee-script | |
==> Downloading http://github.com/jashkenas/coffee-script/tarball/0.9.2 | |
######################################################################## 100.0% | |
==> ./bin/cake --prefix /usr/local/Cellar/coffee-script/0.9.2 install | |
/usr/local/Cellar/coffee-script/0.9.2: 33 files, 556K, built in 2 seconds |
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
$ -> | |
bands = null | |
class Band extends Backbone.Model | |
initialize: -> | |
console.log "initializing model #{@inspect()}" | |
inspect: -> | |
console.log "inspect" | |
s = [] |
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
$ mm-init my_fine_project | |
create my_fine_project/config.rb | |
create my_fine_project/source/index.html.erb | |
create my_fine_project/source/layout.erb | |
create my_fine_project/source/stylesheets | |
create my_fine_project/source/stylesheets/site.css.scss | |
create my_fine_project/source/javascripts | |
create my_fine_project/source/images |
OlderNewer