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
james = "say it loud!" | |
#1 | |
def james.more | |
puts "#{self} I'm black and proud!" | |
end | |
#2 | |
class << james | |
def power |
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
# chop.rb | |
# zastav [@samueltonini] | |
#1 | |
def chop(v, arr) | |
return false if arr.empty? | |
min = 0 | |
max = arr.length - 1 |
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
# singleton_class.rb | |
# zastav [@samueltonini] | |
obj = Object.new | |
def obj.who_i_am? | |
puts "I'm a singleton method" | |
end | |
singleton_class = class << obj |
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
# encoding: utf-8 | |
require "yaml" | |
require "yaml/encoding" | |
input_for_yaml = { | |
:phonetic_notation => "[ə’kɒmplɪʃ]", | |
:words => ["schaffen", "vollbringen", "vollenden", "leisten", "durchführen"] | |
} |
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
recipe = <<END | |
Für 4 Personen | |
Metall- oder Holzspiesse | |
Backpapier für das Blech | |
Chutney: | |
500 g säuerliche Äpfel, z. B. Cox Orange, geschält, in kleine Stücke geschnitten | |
2-3 EL Korinthen | |
225 g Zucker |
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 'uri' | |
require 'open-uri' | |
require 'nokogiri' | |
@from = "en" | |
@to = "de" | |
@word_to_translate = "accomplish" | |
@url = "http://www.google.ch/dictionary?source=translation&hl=en&q=##{@word_to_translate}&langpair=#{@from}|#{@to}" |
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
lambda { | |
hash = {} | |
Kernel.send :define_method, :say do |sentence, &block| | |
hash[sentence] = block | |
end | |
Kernel.send :define_method, :hello do |&block| | |
hash.each_pair do |sentence, say| |
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
## | |
# :attr_reader: dependencies | |
# | |
# A list of Gem::Dependency objects this gem depends on. | |
# | |
# Use #add_dependency or #add_development_dependency to add dependencies to | |
# a gem. | |
array_attribute :dependencies |
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
qwandry-0.0.1/lib/qwandry/launcher.rb:67:in `system': can't convert nil into String (TypeError) |
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
# Create backdoor method in session controller | |
# Backdoor login for feature testing | |
def backdoor_login | |
# be sure to be logged out | |
logout! | |
# Kill / reset the current session | |
reset_session |
OlderNewer