This file contains 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
<script> | |
<% if File.exists? Rails.root.join('public/assets/manifest.yml') %> | |
window.railsAssetManifest = <%= raw YAML.load_file(Rails.root.join('public/assets/manifest.yml')).to_json %>; | |
<% else %> | |
window.railsAssetManifest = {}; | |
<% end %> | |
window.railsAssetPath = function(assetName){ | |
result = (!!window.railsAssetManifest[assetName] ? window.railsAssetManifest[assetName] : assetName); | |
return ('/assets/' + result); |
This file contains 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
function fpushrel () { | |
# Assertion: At least one arg | |
if [ -z $1 ]; then | |
echo "ERROR: Please provide a branch to push (eg staging/production)"; return | |
fi | |
# Assertion: No uncommited changes | |
if ! [ $(git status -s | wc -l) -eq 0 ]; then | |
echo "ERROR: You have changes that have not been committed"; return | |
fi |
This file contains 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 'scss_lint' | |
module SassExtractor | |
mattr_accessor :color_var_nodes | |
mattr_accessor :color_nodes | |
self.color_var_nodes = [] | |
self.color_nodes = [] | |
module Vistors | |
class VariableGatherer < SCSSLint::Linter |
This file contains 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
core: &core | |
adapter: postgresql | |
host: 127.0.0.1 | |
username: postgres | |
database: magnum<%= ENV['TEST_ENV_NUMBER'] %> | |
development: | |
<<: *core | |
test: | |
<<: *core |
This file contains 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
set :local_path, Dir.pwd | |
namespace :deploy do | |
namespace :assets do | |
desc 'Run asset procompilation locally' | |
task :precompile_locally, :roles => :web, :except => {:no_release => true} do | |
run_locally("bundle exec rake assets:precompile") | |
end |
This file contains 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
namespace :deploy do | |
namespace :assets do | |
task :remove_digests do | |
run %( cd #{latest_release} && bundle exec rake assets:remove_digests RAILS_ENV=#{rails_env}), :once => true | |
end | |
end | |
end | |
after 'deploy:assets:precompile', 'deploy:assets:remove_digests' |
This file contains 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 AssociationCounter | |
def count_sql_for(association_sym) | |
association_table_name = reflect_on_association(association_sym).klass.table_name | |
select("count(#{association_table_name}.id) as #{association_sym}_count").joins(association_sym).to_sql | |
end | |
end | |
ActiveRecord::Base.send(:extend, AssociationCounter) |
This file contains 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 "spec_helper" | |
describe ExampleMailer do | |
describe :new_user do | |
let(:user) { FactoryGirl.create :user } | |
it "sends to the correct addresses" do | |
# :mail is similar to the controller specs 'get', 'post' etc methods | |
mail :new_user, user |
This file contains 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
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
def tupleize number | |
units = { | |
1 => "single", | |
2 => "double", | |
3 => "triple", | |
4 => "quadruple", | |
5 => "quintuple", |
This file contains 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 ActiveAdminHelper | |
def admin_arbre_context | |
@admin_arbre_context ||= Arbre::Context.new(assigns, self) | |
end | |
def default_renderer | |
case controller.send(:resource_class).name | |
when "ActiveAdmin::Page" | |
"page" |
NewerOlder