Skip to content

Instantly share code, notes, and snippets.

=begin
BoardLine
---------
Describe one line in the result board.
=end
class BoardLine
include Enumerable
attr_accessor :values
Instance 1 - 20 departments
Department Area f_ij 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 76 1 95 93 2 10 79
2 20 2 69 16
3 68 3 70 12 2
4 50 4 71 6
5 50 5 16 91 30 78 4
6 55 6 60 66 86 75 49 64
Sending: Hi @Travelanswerman, Join our new #advertising platform now and convert your followers into steady #income, and also get 5$ immediately! admonetize.me #social
Automated resposed detected, sleeping for 60 seconds
Sending: Hi @Travelanswerman, Join our new #advertising platform now and convert your followers into steady #income, and also get 5$ immediately! admonetize.me #earn
Automated resposed detected, sleeping for 60 seconds
Sending: Hi @Travelanswerman, Join our new #advertising platform now and convert your followers into steady #income, and also get 5$ immediately! admonetize.me #advertising
Automated resposed detected, sleeping for 60 seconds
Sending: Hi @Travelanswerman, we have noticed you might be a good fit to test our new Twitter advertising platform @ http://admonetize.me #marketing
Automated resposed detected, sleeping for 60 seconds
Sending: Hi @Travelanswerman, Join our new #advertising platform now and convert your followers into steady #income, and also get 5$ immediately! admonetize
class ParkingLot
def initialize
end
def on_entry
end
def on_exit
end
@eladmeidar
eladmeidar / parking_lot.rb
Created December 1, 2014 17:03
Parking lot basics
class ParkingLot
end
class Car
end
class Ticket
class Title
attr_reader :string
def initialize(string)
@string = string
end
def fix
# A neat Ruby trick for making an array of strings
# Equivalent to: ['a', 'and', 'the', 'of']
def proclaim
new_array = [] # Creating a new array to collect the words
string.split.each do |word| # Iterate over each word
new_array << "#{word}!" # add same words we are iterating over, just with an exclamation mark.
end
new_array.join(' ') # return new words array as a string
end
module TestFactories
def post_without_user(options={})
post_options = {title: 'Post title', body: 'Post bodies must be pretty long.'}.merge(options)
post = Post.new(post_options)
post.save
post
end
def authenticated_user
email = "email#{rand}@fake.com"
@eladmeidar
eladmeidar / debug.rb
Created November 3, 2014 15:02
HTTParty debugging for Grisha
2.0.0-p576 :009 > class Zibi
2.0.0-p576 :010?> include HTTParty
2.0.0-p576 :011?> debug_output $stdout
2.0.0-p576 :012?> end
=> #<IO:<STDOUT>>
2.0.0-p576 :013 > Zibi.head("http://walla.co.il")
opening connection to walla.co.il:80...
opened
<- "HEAD / HTTP/1.1\r\nConnection: close\r\nHost: walla.co.il\r\n\r\n"
-> "HTTP/1.0 302 Found\r\n"
module EladPaginator
def self.included(base)
base.class_eval do
include InstanceMethods
extend ClassMethods
end
end