- Apache conf
- Enable URL with OVH
cd /etc/apache2/sites-available
touch my-url.domaine.com.conf
go to http://www.google.fr/intl/fr/enterprise/apps/business/products/gmail/
###Account Start it, fill fields...
###Check the domain
Go to configuration, and valid the 2 first steps
#####Step "google-site-verification" :
On OVH, go to your domain, DNS area
, add new entry
. Choose TXT
and set the value
with google-site-verification=a_really_fat_string
.
gid = class_instance.to_global_id # method allowing to get a string with both model name and id | |
GlobalID::Locator.locate(gid) # method of getting the object by its global id (very useful for collections of multiple type of objects, e.g. for polymorphic associations) | |
Example : | |
In the model that has a polymorphic attribute detailable: | |
getter: | |
def global_detailable | |
detailable.to_global_id if detailable.present? |
Pandas, Numpy, SciPy - libraries for vectorized calculations of non structured data | |
Folium - geographic data | |
iPython - work environment | |
List ~ Array (methods: append, insert, del) | |
Dictionary (dict) ~ Hash | |
.type ~ .class | |
| ~ || | |
& ~ && |
config.time_zone #ActiveRecord fetches the UTC time from the database and converts it to the time zone in | |
DateTime #if you need support for times very far from the present | |
# Good practices | |
2.hours.ago # => Thu, 27 Aug 2015 14:39:36 AFT +04:30 | |
1.day.from_now # => Fri, 28 Aug 2015 16:39:36 AFT +04:30 | |
Time.zone.parse("2015-08-27T12:09:36Z") # => Thu, 27 Aug 2015 16:39:36 AFT +04:30 | |
Time.current # => Thu, 27 Aug 2015 16:39:36 AFT +04:30 | |
Time.current.utc.iso8601 # When supliyng an API ("2015-08-27T12:09:36Z") |
# search(column name ('or' to be able to search in several columns + type de recherche, e.g. 'end' - last characters of the column, 'cont' - contains) | |
User.search('email_end' => 'gmail.com').result | |
User.search('first_name_or_last_name_cont' => 'bob').result | |
ActiveAdmin.describe User do | |
filter :first_name_cont, label: 'First Name' | |
end | |
# association name + name of column in the associated model + type of search | |
ActiveAdmin.describe User do |
# using bsearch wherenever possible :) | |
require 'benchmark' | |
data = (0..50_000_000) | |
Benchmark.bm do |x| | |
x.report(:find) { data.find {|number| number > 40_000_000 } } | |
x.report(:bsearch) { data.bsearch {|number| number > 40_000_000 } } | |
end |
a = ["a", "b", "c"] | |
a.slice(1, 2) | |
# => ["b", "c"] | |
a = ["a", "b", "c"] | |
a.slice_before("b").to_a | |
# => [["a"], ["b", "c"]] | |
a = ["000", "b", "999"] | |
a.slice_before(/[a-z]/).to_a |
# to_i and to_int; | |
# to_s and to_str; | |
# to_a and to_ary; | |
# to_h and to_hash. | |
"string" + other #will call to_str on other, [1,2,3] + other will call #to_ary and so on (and will raise TypeError: no implicit conversion if object not responds to this methods); | |
"string" * other || [1,2,3] * other # will call #to_int on other; | |
a, b, c = *other # will call other to_ary (and, therefore, can be used to “unpack” custom collection objects—but also can cause unintended behavior, if other implements to_ary but was not thought as a collection); | |
some_method(*other) #—same as above, uses other#to_ary; | |
some_method(**other) #—new in Ruby 2, uses other#to_hash. |
// child combinator (>) | |
ol > li { | |
color: red; | |
} | |
// general sibling combinator (~) | |
.featured-image ~ p { | |
font-size: 90%; | |
} |