export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
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 Edition < ActiveRecord::Base | |
scope :distances_any, -> (*distances) { | |
where("distances ?| array[:values]", values: distances) | |
} | |
private | |
def self.ransackable_scopes(auth_object = nil) | |
%i(distances_any) | |
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 pluck(key) | |
map { |h| h[key] } | |
end | |
# a = [ | |
# {id: 1, name: 'John' }, | |
# {id: 2, name: 'Doe' }, | |
# {id: 3, name: 'John' }, | |
# { name: 'Doe' } |
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 BulkUpdatable | |
extend ActiveSupport::Concern | |
self.included do |base| | |
# Usage: | |
# | |
# User.bulk_update([{id: 1, name: 'Foo'}, {id: 2, name: 'Bar'}]) | |
# (1.5ms) UPDATE "users" SET "id" = 1, "name" = 'Foo' WHERE "users"."id" = 1; | |
# UPDATE "users" SET "id" = 2, "name" = 'Bar' WHERE "users"."id" = 2 | |
# => #<PG::Result:0x007f814aa04c40 status=PGRES_COMMAND_OK ntuples=0 nfields=0 cmd_tuples=1> |
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, body, div { | |
margin: 0; | |
padding: 0; | |
} | |
.clearfix:after { | |
margin: 0; | |
padding: 0; | |
content: ""; | |
display: block; |