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 Book | |
def title_and_author(title, author) | |
@title = title | |
@author = author | |
end | |
def description | |
"#{@title} was written by #{@author}" | |
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 Array | |
def sum_numbers | |
total = 0 | |
self.each do |member| | |
total += member | |
end | |
total | |
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 Student | |
class Config | |
attr_accesor :name, :age, :iq | |
end | |
def Student.config(&block) | |
@config = Student::Config.new | |
yield block(@config) | |
true | |
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
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each) do | |
DatabaseCleaner.strategy = :transaction | |
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
<html> | |
<head> | |
<title>My Page</title> | |
</head> | |
<body> | |
<h1>Horray!!</h1 | |
</body> | |
</html> |
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
# Add numbers 4 and 5 | |
# Print "Hello" | |
# Write an expression that evaluates to whatever was stored in variable x | |
# Write an experssion that evaluates to whatever was in x plus 1 | |
# Write an expression that evaluates to true if x is greater than 5 and evaluates to false otherwise | |
# Write a condition that prints "hello" if variable "person" is a symbol :friend and does nothing otherwise | |
# Write a condition that prints "enough" if x is greater than 100 and prints "not enough" otherwise | |
# Write a condition that returns "good morning" when "hour < 12" and "good afternoon" when "hour >= 12" | |
# Define a method named "method" that takes no arguments | |
# Define a method named "foo" that takes one argument named "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
Fetching git://github.com/radar/better_spree_paypal_express.git | |
remote: Reusing existing pack: 1284, done. | |
remote: Total 1284 (delta 0), reused 0 (delta 0) | |
Receiving objects: 100% (1284/1284), 181.85 KiB | 174.00 KiB/s, done. | |
Resolving deltas: 100% (388/388), done. | |
Fetching gem metadata from https://rubygems.org/........ | |
Fetching additional metadata from https://rubygems.org/.. | |
Resolving dependencies... | |
Bundler could not find compatible versions for gem "spree_core": | |
In Gemfile: |
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 'rubygems' | |
require 'skype' | |
Skype.config :app_name => "Prepare" | |
120.times do | |
Skype.message "miki.bergin", "תכין" | |
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 remove_trailing_zeros(array = []) | |
if array.size > 0 && array[-1].to_i == 0 | |
array.pop | |
remove_trailing_zeros(array) | |
else | |
array | |
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
link "http://api.plnkr.co/catalogue/packages?" | |
95.times do |i| | |
page = i + 1 | |
# use page here in the request | |
end | |
# ever use while like that again and i'll come over there and kill you |
OlderNewer