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
$(window).on("resize, orientationchange", function() { | |
$.throttle(function() { | |
$(".custom-select").customSelect(); | |
}, 500); | |
}); |
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
#!/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 |
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
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 |
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
# 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 |
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
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
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 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) |
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
#!/bin/bash | |
bundle exec sass-convert public/_mockups/default.css app/assets/stylesheets/default.scss | |
sed -i 's/url(..\/img\/\(.*\))/image-url("\1")/g' app/assets/stylesheets/default.scss | |
sed -i 's/url("..\/img\/\(.*\)")/image-url("\1")/g' app/assets/stylesheets/default.scss | |
sed -i "s/url('..\/img\/\(.*\)')/image-url(\"\1\")/g" app/assets/stylesheets/default.scss | |
sed -i "s/url('..\/fonts\/\([a-zA-Z0-9./?#_-]*\)')/font-url('\1')/ig" app/assets/stylesheets/default.scss |
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
// A utility for keeping a Bootstrap drop down menu open after a link is | |
// clicked | |
// | |
// Usage: | |
// | |
// <div class="dropdown"> | |
// <a href="" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> | |
// Dropdown trigger <span class="caret"></span> | |
// </a> | |
// |