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
export PS1='\[\033[01;32m\]\w $(git branch &>/dev/null; if [ $? -eq 0 ]; then echo "\[\033[01;34m\]$(git branch | grep '^*' |sed s/\*\ //)"; fi) \$ \[\033[00m\]' |
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
merb_auth_routes(:name_prefix => nil, :path_prefix => "") do | |
match("/openid").to(:controller => "merb_auth_slice_password/sessions", :action => "update").name(:openid) | |
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
given "logged in" do | |
login | |
end | |
context "when logged in" do | |
context "Homepage: url(:home)", :given => "logged in" do | |
before(:each) do | |
@rack = request(:home) | |
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
New entry posted to the journal: | |
= self.params[:entry].body |
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
# authorize :some_label => ["list", "of", "strategies"] | |
class Post | |
authorize :edit => ["my_strategy", "another_one"], | |
:create => "some_other_strategy", | |
:view => "view_strategy" | |
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
class Article | |
include DataMapper::Resource | |
authorizable! | |
authorize_with do | |
with(:view ).use(:Public, :ViewPublished, :Admin, :PublisherRole) | |
with(:view_draft).use(:Owner, :PublisherRole, :Admin) | |
with(:edit ).use(:Owner, :Admin) | |
with(:create ).use(:Public) | |
with(:delete ).use(:Admin) |
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 file is specifically for you to define your strategies | |
# | |
# You should declare you strategies directly and/or use | |
# Merb::Authentication.activate!(:label_of_strategy) | |
# | |
# To load and set the order of strategy processing | |
Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true | |
module Merb::Authentication::Strategies |
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
class Merb::Authorization | |
operator_classes User, Staff, Customer, Group, String, Hash | |
operator_aliases :can?, is?, :authorized_for?, :authorized_to?, :authorized_with? | |
end | |
## The aliases allow for | |
user.authorized? | |
user.can? | |
user.is? |
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
function(doc) { | |
if ( doc["couchrest-type"] == "Account" ) { | |
emit(doc._id, ["Account", doc]); | |
} | |
if ( doc["couchrest-type"] == "Contact" ) { | |
emit(doc.account_id, ["Contact", doc]); | |
} | |
} |
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 'benchmark' | |
class Foo | |
attr_accessor :the_blocks, :method_map | |
class Bar | |
def bar | |
:bar | |
end | |
end |