Add these few lines to Gemfile:
gem 'rack-mini-profiler', :require => false
gem 'flamegraph'
gem 'stackprof'
gem 'memory_profiler'Add this to config/initializers/rack_profiler.rb
| class Alert | |
| belongs_to :alertable, polymorphic: true | |
| belongs_to :incident, ->{ joins(:alerts).where(alerts: { id: Alert.where(alertable_type: "Incident") }) }, foreign_key: :alertable_id | |
| belongs_to :action, ->{ joins(:alerts).where(alerts: { id: Alert.where(alertable_type: "Action") }) }, foreign_key: :alertable_id | |
| end | |
| Alert.includes(incident: :categories, action: :agencies) |
Add these few lines to Gemfile:
gem 'rack-mini-profiler', :require => false
gem 'flamegraph'
gem 'stackprof'
gem 'memory_profiler'Add this to config/initializers/rack_profiler.rb
To maximize Firefox window in all Cucumber scenarios, place this in your support/env.rb.
Before do
Capybara.current_driver == Capybara.javascript_driver
page.driver.browser.manage.window.maximize
end
end| # Based on http://www.postgresql.org/download/linux/ubuntu/ | |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' | |
| wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add - | |
| sudo apt-get update | |
| sudo apt-get install postgresql postgresql-contrib |
| def print_browser_logs | |
| logs = page.driver.browser.manage.logs.get(:browser).map { |line| [line.level, line.message] } | |
| logs.reject! { |line| ["WARNING", "INFO"].include?(line.first) } | |
| puts "========== BROWSER LOGS ==========" | |
| logs.each do |line| | |
| puts line.join(" - ") | |
| end | |
| puts "==================================" | |
| end |
| #!/bin/bash | |
| curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: token API_TOKEN" -X POST -d '{"ref":"refs/heads/D-commit", "sha":"LOST_SHA"}' https://api.github.com/repos/ACCOUNT/PROJECT/git/refs |
| $(window).on("resize, orientationchange", function() { | |
| $.throttle(function() { | |
| $(".custom-select").customSelect(); | |
| }, 500); | |
| }); |
| 1. Figure out the data set | |
| 2. Split the data set into resources. | |
| For each kind of resource: | |
| 3. Name the resources with URIs. | |
| 4. Expose a subset of the uniform interface. | |
| 5. Design the representation(s) accepted from the client. | |
| 6. Design the representation(s) served to the client. | |
| 7. Integrate this resource into eisting resources, using hypermedia links and forms. | |
| 8. Consider the typical course of events: what's supposed to happen? | |
| 9. Consider error conditions: what might go wrong? |
| function getScopes(root) { | |
| var scopes = []; | |
| function traverse(scope) { | |
| scopes.push(scope); | |
| if (scope.$$nextSibling) | |
| traverse(scope.$$nextSibling); | |
| if (scope.$$childHead) | |
| traverse(scope.$$childHead); | |
| } | |
| traverse(root); |