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
# Using Dalli Store gem for default caching, just use Rails.cache directly | |
# https://github.com/petergoldstein/dalli | |
Rails.cache.fetch('some-key', expires_in: 1.hour) do | |
#foo baa and a lot of work | |
end | |
# Now use Rails FileStore cache as alternative strategy by using ActiveSupport::Cache::FileStore directly | |
cache = ActiveSupport::Cache::FileStore.new File.join(Rails.root, 'tmp', 'cache', 'some-name') | |
cache.fetch('some-key', expires_in: 1.hour) do | |
# some hard work returning a huge dataset to large for memcached |
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
da: | |
devise: | |
failure: | |
invited: "Du har en ventende invitation, accepter den for at færdiggøre oprettelsen af din konto." | |
invitations: | |
send_instructions: "En invitationsemail er sendt til %{email}." | |
invitation_token_invalid: "Invitations nøglen er ikke valid!" | |
updated: "Din adgangskode blev gemt. Du er nu logget ind." | |
updated_not_active: "Din adgangskode blev gemt." | |
no_invitations_remaining: "Ingen tilbageværende invitationer." |
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
# Will apply a jQuery Autocomplete on an input field, given input field has data-autocomplete set to a json object | |
# with keys: | |
# - path Being path to autocomplete source, taking ?term=query as search argument | |
# - target Target field name, e.g. 'id'. Will create a hidden target field where name of autocomplete input field is | |
# replaced with this `target` name. So if input is autocomplete_name target field will be autocomplete_id. | |
# It will apply the object value with key of same value as target. So in above example key will be id. | |
# - params Allows you to append additional params to the final source URL. Formatted key:value;key:value;key:value | |
# For `value` we'll lookup a input field with the `value` as id and take it's value. | |
$(document).on 'focus', 'input[data-autocomplete]', -> | |
settings = $(this).data('autocomplete') |
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
require 'bundler/inline' | |
require 'json' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'rest-client' | |
gem 'nokogiri' | |
gem 'memory_profiler' | |
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
require 'bundler/inline' | |
require 'json' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'httparty' | |
gem 'nokogiri' | |
gem 'memory_profiler' | |
end |