Skip to content

Instantly share code, notes, and snippets.

@eladmeidar
eladmeidar / book.rb
Created January 29, 2014 20:49
basic book
class Book
def title_and_author(title, author)
@title = title
@author = author
end
def description
"#{@title} was written by #{@author}"
end
end
class Array
def sum_numbers
total = 0
self.each do |member|
total += member
end
total
end
end
class Student
class Config
attr_accesor :name, :age, :iq
end
def Student.config(&block)
@config = Student::Config.new
yield block(@config)
true
end
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
<html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Horray!!</h1
</body>
</html>
# 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"
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:
@eladmeidar
eladmeidar / miki2prepare.rb
Created May 13, 2014 16:28
Make miki prepare quickly
# encoding: utf-8
require 'rubygems'
require 'skype'
Skype.config :app_name => "Prepare"
120.times do
Skype.message "miki.bergin", "תכין"
end
@eladmeidar
eladmeidar / remove_trailing.rb
Created July 8, 2014 10:29
ניקיטה הנסיך
def remove_trailing_zeros(array = [])
if array.size > 0 && array[-1].to_i == 0
array.pop
remove_trailing_zeros(array)
else
array
end
end
@eladmeidar
eladmeidar / example.rb
Last active August 29, 2015 14:04 — forked from anonymous/example.rb
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