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 Person | |
attr gender | |
def male? | |
@gender == 'male' | |
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
module ActiveRecord | |
class Base | |
def read_only? | |
ENV["AR_READ_ONLY"] ||= false | |
end | |
def before_destroy | |
raise ActiveRecord::ReadOnlyRecord if read_only? | |
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 heavy_decimal_count(a,b) | |
(a..b).select do |number| | |
chars = number.to_s.split('').collect{|x| x.to_i} | |
get_avg(chars) > 7 | |
end | |
end | |
def get_avg(arr) | |
arr.inject{|sum,x| sum + x }.to_f / arr.size | |
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 heavy_decimal_count(a,b) | |
heavy = [] | |
(a..b).collect do |number| | |
chars = number.to_s.split('').collect{|x| x.to_i} | |
heavy << number if (get_avg(chars) > 7) | |
end | |
heavy | |
end | |
def get_avg(arr) |
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 bookmark! | |
uri = Addressable::URI.new | |
uri.query_values = cleanse(params) | |
uri.path = request.env["REQUEST_PATH"] | |
session[:last_bookmark] = uri.to_s | |
end | |
def bookmark | |
session[:last_bookmark] ||= root_path | |
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
accommodation_types: | |
view_all: View all | |
host-family: Host Family | |
student-residence: Student Residence | |
hotel: Hotel | |
apartment-or-studio: Apartment or Studio | |
bed-breakfast: "Bed & Breakfast" | |
campus-residence: Campus Residence |
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 locale_from_currency(currency) | |
case currency | |
when :GBP | |
:en | |
when :USD | |
:en | |
when :EUR | |
:de | |
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
resources :messages, :except => [:index] do | |
collection do | |
get :create_new, controller: 'messages/build', action: :create | |
end | |
resources :build, controller: 'messages/build' | |
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
#gbx3, .gbes, #gbz, .aeG>.ov, #gbi4t, .TC, #oneGoogleWrapper #gb, #gbar-header #gb { | |
display: none !important; | |
} | |
.AOaixb.yRwDId.eub5Ne { | |
top: 120px !important; | |
} | |
#docs-header.docs-og-minibar #docs-titlebar-container { | |
top: -50px; | |
} | |
#gbu, #gbq, #gbx1 { |
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
$ ~/ nslookup | |
> server 8.8.8.8 | |
Default server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
> o localhost | |
Server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
Non-authoritative answer: | |
Name: o.dev.kyanmedia.net |