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 < ActiveRecord::Base | |
| belongs_to :alertable, :polymorphic => true | |
| end | |
| class Region < ActiveRecord::Base | |
| has_many :alerts, :as => :alertable | |
| 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <svg id="defs"> | |
| <defs> | |
| <linearGradient id="gradBlue" x1="0%" y1="0%" x2="100%" y2="0%"> |
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
| module YourApp | |
| class Application < Rails::Application | |
| # ... | |
| config.middleware.insert_before "Rack::Cache", "SubdomainRedirect" | |
| # ... | |
| end | |
| 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
| <%= simple_form_for @product do |f| %> | |
| <%= f.simple_fields_for :attributes do |d| %> | |
| <% f.object.attributes.try(:each) do |key, value| %> | |
| <%= d.input key, :input_html => {:value => value } %> | |
| <% end %> | |
| <% end %> | |
| <% 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
| # Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
| # the mechanics, not a real-world use case. | |
| # NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
| # extension that works for any named association. That's what I really wanted! | |
| # Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
| # == DEFINITIONS | |
| # - A Taxi is a car for hire. A taxi has_many :passengers. | |
| # - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
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
| yum install gcc-c++ make openssl-devel python26 | |
| cd /usr/local/src/ | |
| wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz | |
| tar zxvf node-v0.10.28.tar.gz | |
| cd node-v0.10.28/ | |
| export PYTHON=/usr/bin/python26 | |
| $PYTHON ./configure | |
| make | |
| make install |
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
| # Use this setup block to configure all options available in SimpleForm. | |
| SimpleForm.setup do |config| | |
| # you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile | |
| config.input_class = "form-control" | |
| config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b| | |
| b.use :html5 | |
| b.use :placeholder | |
| b.use :label | |
| b.use :input |
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 | |
| i=0 | |
| files=() | |
| # sort spec files by number of examples for better balancing | |
| for file in $(find ./spec -name "*_spec.rb" -print0 | xargs -0 grep -e "^ *it" -c | sort -t: -k2,2rn | awk -F":" '{ print $1 }') | |
| do | |
| if [ $(($i % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ] | |
| then | |
| files+=" $file" |
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 'cucumber/rake/task' | |
| NUM_RETRIES = ENV['NUM_RETRIES'] || 2 | |
| task :default => "cucumber:run" | |
| namespace :cucumber do | |
| directory "tmp" | |
| @rerun_file = 'tmp/rerun.txt' |
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/sh | |
| remove_dangling() { | |
| echo "Removing dangling images ..." | |
| docker rmi $(docker images -f dangling=true -q) | |
| } | |
| remove_stopped_containers() { | |
| echo "Removing stopped containers ..." | |
| docker rm $(docker ps -qa) |