save_and_open_page
have_button(locator)| class ApplicationController < ActionController::Base | |
| before_filter :enable_http_auth, if: :use_http_auth? | |
| private | |
| def use_http_auth? | |
| Rails.env.production? | |
| end | |
| def enable_http_auth |
| preload_app! | |
| min_threads = Integer(ENV['MIN_THREADS'] || 0) | |
| max_threads = Integer(ENV['MAX_THREADS'] || 5) | |
| threads min_threads, max_threads | |
| workers Integer(ENV['WORKER_COUNT'] || 3 ) | |
| on_worker_boot do | |
| ActiveSupport.on_load(:active_record) do |
| # Thanks to http://stackoverflow.com/a/927275/1041467 | |
| def debug_msg(msg, title = 'DEBUG') | |
| Rails.logger.debug "\e[5;1;34m#{title}:\e[0m #{msg}" | |
| end |
| // create an index with an analyzer "myindex" | |
| curl -X PUT localhost:9200/myindex -d ' | |
| { | |
| "settings" : {` | |
| "index":{ | |
| "number_of_replicas":0, | |
| "number_of_shards":1, | |
| "analysis":{ | |
| "analyzer":{ | |
| "first":{ |
| def choose_autocomplete_result(item_text, input_selector = 'input[data-autocomplete]') | |
| page.execute_script %{ $('#{input_selector}').trigger("focus") } | |
| page.execute_script %{ $('#{input_selector}').trigger("keydown") } | |
| item_selector = "ul.ui-autocomplete li.ui-menu-item:contains('#{item_text}')" | |
| expect(page).to have_selector('ul.ui-autocomplete li.ui-menu-item', text: item_text) | |
| page.execute_script %{ $("#{item_selector}").trigger("mouseenter").trigger("click"); } | |
| end |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
TL;DR
sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main| #/usr/local/Library/Formula/sphinx.rb | |
| class Sphinx < Formula | |
| desc "Sphinx is a full-text search engine" | |
| homepage "http://www.sphinxsearch.com" | |
| revision 1 | |
| stable do | |
| url 'http://sphinxsearch.com/files/sphinx-2.1.6-release.tar.gz' | |
| sha1 'fe4dfc605afe8f58d9e25fd0c58dfed1673ec4b1' |