Skip to content

Instantly share code, notes, and snippets.

class Admin::PlayersController < ApplicationController
before_filter :authenticate
before_filter :load_player, :except => [:index, :new, :create]
def index
@players = Player.all
end
def show
Feature: Log in
In order to get access to protected sections of the site
A user
Should be able to log in
Scenario: User is not signed up
Given no user exists with a login of "admin"
When I go to the log in page
And I log in with "admin/password"
Then I should see "Bad login or password"
Feature: Managed Categories
As a user
I want to manage categories
So that I can present readers with an easily navigable list of recipe types
Scenario: New category
Given a tag exists with a name of "vegan"
And a user exists with "admin/password"
And I log in with "admin/password"
And I am on the new category page
Factory.factories.each do |name, factory|
Given /^an? #{name} exists with an? (.*) of "([^"]*)"$/ do |attr, value|
Factory(name, attr.gsub(' ', '_') => value)
end
end
Given /^category "(\w+)" is tagged with "([^\"]*)"$/ do |name, tag|
Factory(:category, :name => name, :tag_list => tag)
end
/usr/lib/ruby/gems/1.8/gems/em-redis-0.1.1/lib/em-redis/redis_protocol.rb:457:in `process_cmd': undefined local variable or method `code' for #<#<Class:0x7f30ccb9c568>:0x7f30ccb9c248> (NameError)
from /usr/lib/ruby/gems/1.8/gems/em-redis-0.1.1/lib/em-redis/redis_protocol.rb:374:in `receive_data'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run_machine'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:291:in `fork_reactor'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:285:in `fork'
from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:285:in `fork_reactor'
from /home/brandon/botbckt/lib/botbckt/bot.rb:39:in `start'
from /home/brandon/botbckt/lib/botbckt/cmd.rb:9:in `run'
;; Turn off MuMaMo's goofy backgrounds
(custom-set-faces
'(mumamo-background-chunk-major ((((class color)
(min-colors 88)
(background light))
(:background "#fff"))))
'(mumamo-background-chunk-submode1 ((((class color)
(min-colors 88)
(background light))
(:background "#fff")))))
module ShouldaContextExtensions
def self.included(base)
base.class_eval do
alias_method_chain :build, :fast_context
alias_method_chain :am_subcontext?, :fast_context
end
end
def fast_context(name, &blk)
@fast_subcontexts ||= []
(ns sudoku
(:use [clojure.contrib.combinatorics :only (selections)]))
(defn numerical [s]
(if (= "." (str s))
0
(Integer/parseInt (str s))))
(defn read-matrix [file]
(vec (map #(vec %)
struct foo {
int type;
#define TYPE_INT 1
#define TYPE_PAIR_OF_INTS 2
#define TYPE_STRING 3
union {
int i; // If type == TYPE_INT.
int pair[2]; // If type == TYPE_PAIR_OF_INTS.
char *str; // If type == TYPE_STRING.
} u;