This file contains hidden or 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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze | |
| changed_files = `git status --porcelain`.split(/\n/) | |
| unstaged_files = `git ls-files -m`.split(/\n/) | |
| changed_files = changed_files.select { |f| f =~ ADDED_OR_MODIFIED } | |
| changed_files = changed_files.map { |f| f.split(" ")[1] } |
This file contains hidden or 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
| # По умолчанию запускаем только необходимых для тестов наблюдателей, | |
| # то есть всех, кроме server. | |
| # Для запуска всех: bundle exec guard -g default | |
| scope groups: ['specs'] | |
| group 'specs' do | |
| # запускаем тесты и использованием Spring | |
| guard :rspec, cmd: "bundle exec spring rspec" do | |
| require "guard/rspec/dsl" | |
| dsl = Guard::RSpec::Dsl.new(self) |
This file contains hidden or 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
| var form = $('#new_answer'), | |
| alert = form.find('#error_validation'); | |
| alert.remove(); | |
| <% if @answer.errors.any? %> | |
| form.prepend('<%= j render 'layouts/shared/error_form', object: @answer %>'); | |
| <% else %> | |
| $('#answersList').append('<%= j render @answer %>'); | |
| form.find('#answer_body').val(''); |
This file contains hidden or 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
| ### Nginx ### | |
| check process nginx with pidfile /opt/nginx/logs/nginx.pid | |
| start program = "/etc/init.d/nginx start" | |
| stop program = "/etc/init.d/nginx stop" | |
| if cpu > 60% for 2 cycles then alert | |
| if cpu > 80% for 5 cycles then restart | |
| if memory usage > 80% for 5 cycles then restart | |
| if failed host 127.0.0.1 port 80 protocol http | |
| then restart | |
| if 3 restarts within 5 cycles then timeout |
This file contains hidden or 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 'open-uri' | |
| require 'nokogiri' | |
| require 'mechanize' | |
| require 'json' | |
| # example data | |
| =begin | |
| [{'id'=>'1505439', | |
| 'code'=>'XY', | |
| 'name'=> |
This file contains hidden or 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
| onReady = -> | |
| searchSelector = 'input.typeahead' | |
| bloodhound = new Bloodhound( | |
| datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'), | |
| queryTokenizer: Bloodhound.tokenizers.whitespace | |
| remote: "/en/autocomplete/index.json?q=%QUERY" | |
| limit: 10) | |
| bloodhound.initialize() | |
| $(searchSelector).typeahead null, |
This file contains hidden or 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 SearchesController < ApplicationController | |
| before_action :load_search, except: [:create, :new ] | |
| def index; end | |
| def show ; end | |
| def new | |
| @search = Search.new | |
| end |
This file contains hidden or 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 Search < ApplicationRecord | |
| # string :destination | |
| # date :checkin | |
| # date :checkout | |
| # integer :adults | |
| # integer :children | |
| # integer :rooms | |
| # string :locale | |
| # string :currency | |
| # string :state |
This file contains hidden or 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
| ready = -> | |
| current_locale = I18n.locale | |
| dataContainer = $('#searchData') | |
| paginationContainer = $('#pagination-data') | |
| sortSearches = (data) -> | |
| if data.status == 'ready' | |
| data = data.results | |
| if data |
OlderNewer