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 PersonEnumerator | |
include Enumerable | |
attr_reader :persons | |
def initialize(persons) | |
@persons = persons | |
end | |
def each &block | |
@persons.each do |person| |
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 Person | |
include Comparable | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def <=> other |
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 'spec_helper' | |
describe ModelDecorator do | |
include Rails.application.routes.url_helpers | |
# see https://github.com/jcasimir/draper/issues/60 | |
before(:each) { | |
c = ApplicationController.new | |
c.request = ActionDispatch::TestRequest.new |
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
#owner | |
$ gem owner gem_name --add rubygems_user | |
$ gem owner gem_name --remove rubygems_user | |
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 Andrea | |
module My_module | |
def self.configure &block | |
instance_eval &block | |
end | |
def self.set(arg) | |
puts 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
module Andrea | |
module My_module | |
def self.configure | |
yield | |
end | |
def self.set(arg) | |
puts 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
include My_package; | |
My_module.configure do | |
set :my_setting, :my_value | |
set :another_setting, :another_value | |
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
createuser nome_utente -P | |
#promt | |
createdb nome_db -O nome_utente |
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
<cfset start = gettickcount()> | |
<cfloop from="1" to="1000" index="i"> | |
<cfcache action="put" id="a#i#" value="#i#"> | |
<cfcache action="get" id="a#i#" name="v"> | |
<cfcache action="put" id="b#i#" value="#{value = i}#"> | |
<cfcache action="get" id="b#i#" name="v"> | |
</cfloop> | |
<cfset end = gettickcount()> | |
<cfoutput>#end - start# millis</cfoutput> |
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
print "What is your name? " | |
$stdout.flush | |
name = gets.chomp | |
puts 'Hi ' + name + '!!!' + name | |
#=> Hi andrea!!! |