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
### Keybase proof | |
I hereby claim: | |
* I am matid on github. | |
* I am matid (https://keybase.io/matid) on keybase. | |
* I have a public key whose fingerprint is BF77 1276 FCC7 254C 0C0E 28AE 8248 346F DDFC 3C94 | |
To claim this, I am signing this object: |
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
it "should require login of minimum 4 chars" do | |
identity = new_identity(:login => "one") | |
identity.should_not be_valid | |
identity.errors.on(:login).should_not be_nil | |
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
def define(label, &block) | |
if block_given? | |
definition = capture(&block) | |
else | |
definition = label.first.last | |
label = label.first.first | |
end | |
content = markaby do | |
dt label.t |
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
<h1>Articles</h1> | |
<% paginate(@articles).each do |article| %> | |
<div> | |
<h2><%= article.title %></h2> | |
<p><%= article.body %></h2> | |
</div> | |
<% 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 Articles < ApplicationController | |
def index | |
@articles = Article.all | |
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
#<ActionView::ReloadableTemplate:0x3b8b750 @previously_last_modified=Tue Mar 17 12:33:12 +0100 2009, | |
@_memoized_method_segment=["app47views47mailer47activation46de46text46plain46erb"], @format="de", | |
@_memoized_relative_path=["app/views/mailer/activation.de.text.plain.erb"], @extension=nil, | |
@_memoized_method_name_without_locals=["_run_app47views47mailer47activation46de46text46plain46erb"], | |
@load_path="/Users/matid/Projects/pokerring.com/trunk/app/views", @base_path="mailer", | |
@filename="/Users/matid/Projects/pokerring.com/trunk/app/views/mailer/activation.de.text.plain.erb", | |
@locale=nil, @name="activation", @template_path="mailer/activation.de.text.plain.erb"> | |
#<ActionView::ReloadableTemplate:0x3b841e4 @previously_last_modified=Tue Mar 17 12:33:25 +0100 2009, | |
@_memoized_method_segment=["app47views47mailer47activation46en46text46plain46erb"], @format="en", |
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
<?php | |
$array = array('abc', 'def'); | |
$string = "String with 'abc' or 'def' in it"; | |
function find($string, $array){ | |
foreach($array as $token){ | |
if(strpos($string, $token) !== false){ | |
return true; | |
} |
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 | |
attr_accessor :title, :body | |
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
# config/initializers/rails3.rb | |
Dir.glob(File.join(RAILS_ROOT, "lib", "rails3", "**", "*")).map { |path| require path } | |
# lib/rails3/presence.rb | |
class Object | |
def presence | |
self if present? | |
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
class PostTest < ActiveSupport::TestCase | |
test "adds 20 points to post author" do | |
@post.save! | |
assert 20, @post.author.points # should be assert_equal | |
end | |
should "add 20 points to post author" do | |
@post.save! | |
@post.author.points == 20 # no assertion, should be "@post.author.points.should == 20" | |
end |
OlderNewer