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
def drink(drink) | |
@drinks << drink | |
end | |
def initialize | |
@drinks = [] | |
end |
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
def hello; "Hello"; end | |
define_method(hello) { "Hello" } |
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
a = [:a, :b, :c] | |
b = [1, 2, 3] | |
[a, b].transpose #=> [[:a, :b, :c], [1, 2, 3]] |
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 Drinks | |
def initialize(&block) # Initialize drinks | |
@drinks = [] | |
instance_eval &block | |
end | |
def drink(d) | |
@drinks << d | |
end # Add drink |
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 Drinks < Array | |
def initialize(&block) | |
instance_eval &block | |
end | |
# Add drink to array | |
def drink(d) | |
self << d | |
end |
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 Hello | |
module World | |
def hello_world | |
"Hello world!" | |
end | |
end | |
include World | |
end |
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
def my_task | |
load "tasks/my_task.rb" | |
end |
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
var editor = CodeMirror.fromTextArea(getElementById('editor'), { | |
theme: <%= @user.theme %> <%# Get users favorite theme from database. %> | |
}); |
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
require 'fileutils' | |
touch %w( file1 file2 file3 ) |
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
# lib/socks.rb | |
require 'socks/version' | |
require 'socks/base_controller' | |
require 'socks/content_helpers' | |
# lib/socks/content_helpers.rb | |
module Socks |