$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.run_server = false | |
Capybara.current_driver = :selenium | |
Capybara.app_host = 'http://www.google.com' | |
module MyCapybaraTest | |
class Test |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
def find_airport_info(lookup_iata_code) | |
page = Nokogiri::HTML(open("https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_#{lookup_iata_code[0]}")) | |
page.yield_self { |page| page.search('.wikitable tr:contains("%s")' % lookup_iata_code)[0] }.yield_self do |row| | |
airport_name_row = row.children[5] | |
airport_info = { | |
name: airport_name_row&.text, |
version: 2 | |
jobs: | |
build: | |
environment: | |
working_directory: ~/circleci-myapp | |
docker: | |
- image: circleci/ruby:2.4.2-node-browsers | |
environment: | |
CC_TEST_REPORTER_ID: XXXYYY | |
RAILS_ENV: test |
GFORCE => git add -A && git commit --amend -C HEAD && git push -f | |
c => git_index | |
cbg => git rev-parse --verify HEAD | simple_clipboard | |
g => git | |
ga => git_add_shortcuts | |
gaa => git add -A | |
gap => git add -p | |
gash => git stash | |
gasha => git stash apply | |
gashl => git stash list |
def with_catch_and_retry(*exceptions_to_catch, times, &block) | |
block.call | |
rescue *exceptions_to_catch => e | |
(times -= 1).zero? ? raise(e) : retry | |
end | |
context = 'nice' | |
with_catch_and_retry(Exception, RuntimeError, 3) { | |
p "123: #{context}" | |
raise 'something' |
## Ryanair.com FE Developer Tests | |
Choose 1 of the following web apps below, build it and submit it to [email protected] with the subject "Developer Test Web App". ZIP files or public Github URLs will be accepted. | |
Provide any build commands or runtime requirements (webserver required, extra packages, environment variables) in an INSTALLATION.txt file at the root of the project. The goal is to have the application as easily deployable as possible. | |
You may use a responsive framework (Foundation, Bootstrap) if you like, but customising the CSS (or SASS) will get you extra kudos. You must use AngularJS as the Javascript framework. | |
### Cheap flight finder |
module ActionController | |
class Metal | |
attr_internal :cached_content_for | |
end | |
module Caching | |
module Actions | |
def _save_fragment(name, options) | |
return unless caching_allowed? |
module ActionController | |
class Metal | |
attr_internal :cached_content_for | |
end | |
module Caching | |
module Actions | |
def _save_fragment(name, options) | |
return unless caching_allowed? |