This file contains hidden or 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 Barby | |
class SwanandRmagickOutputter < RmagickOutputter | |
register :to_jpg_2 | |
def to_jpg_2(*a) | |
to_blob('jpg', *a) | |
end | |
#Returns a string containing a JPEG image | |
def to_blob(format, *a) |
This file contains hidden or 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 User < ActiveRecord::Base | |
# gradual engagement is needed, to allow admin creation of users | |
# users should create authorization data only when they need to | |
# access some system feature that requires authentication | |
# So ... our gradual engagement scheme for authlogic: | |
# 1. admin creates user, setting only name and phone number (required) | |
# admin may set email address (optional) | |
# 2. user is sent email invitation with link to activate their account | |
# admin can re-send email at user's request | |
# 3. user sets login and password/password_confirmation using activation form |
This file contains hidden or 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
# Regular expression for removing blank lines from a text: | |
#Replace this regex | |
/(\s+)^\r?\n?$(\s+)/mix | |
# With | |
$2 # The second match |
This file contains hidden or 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
7.times do | |
ListMixin.create! | |
end | |
assert ListMixin.first.first? | |
assert ListMixin.last.last? | |
assert !ListMixin.last.first? | |
assert !ListMixin.first.last? |
This file contains hidden or 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 M | |
def test | |
puts "test" | |
end | |
end | |
class X | |
include M | |
def test | |
puts "instance" |
NewerOlder