Skip to content

Instantly share code, notes, and snippets.

View thejonanshow's full-sized avatar

Jonan Scheffler thejonanshow

View GitHub Profile
358 desc "Rebuilds the vhost.map or nginx_vhost.map depending on OS, environ +ment, etc."
359 task(:rebuild_vhost_map => :environment) do
360 ClientDomain.rebuild_vhost_map
361 end
<% gallery_li_class = defaults[:gallery_li_class] || "" %>
139 <% gallery_li_class << ' first' if defaults[:photos].first? %>
140 <% gallery_li_class << ' last' if defaults[:photos].last? %>
From the asset model:
def alt_text
attachments.first.alt_text if attachments.first
end
My test:
- f.fields_for :integration_store_codes do |builder|
= builder.label :active
= builder.check_box :active
# in the middle of my form I want access to the original object so I can output it's associated store's name
= builder.magically_turns_into_an_integration_store_code.store.name
= builder.label :code
= builder.text_field :code
@thejonanshow
thejonanshow / silent_assets.rb
Created April 23, 2012 14:51 — forked from cstrahan/silent_assets.rb
Silence/squelch/quiet assets in Rails logger
# Place in config/initializers/
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
end
This is a test of the gist api.
@thejonanshow
thejonanshow / branch_murder
Created May 16, 2012 18:44 — forked from codezilla-xx/branch_murder
Delete all merged local git branches
git branch -d $( git branch --merged | grep -v '^\*' | grep -v 'master' )
@thejonanshow
thejonanshow / chef_solo_bootstrap.sh
Created June 11, 2012 15:23 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
granary•jruby-1.6.7@granary•master»» bundle
Fetching gem metadata from https://rubygems.org/........
Bundler could not find compatible versions for gem "thor":
In Gemfile:
jbundler (>= 0) java depends on
thor (= 0.14.6) java
jquery-rails (>= 0) java depends on
thor (0.15.4)
@thejonanshow
thejonanshow / gist:5180381
Created March 17, 2013 06:27
Bundler `rake spec:deps` error
bundler•ruby-1.9.3-p385@code•master» rake spec:deps
/Users/jonan/.rvm/rubies/ruby-1.9.3-p385/bin/ruby -S gem list rdiscount -v '~> 1.6' | grep 'rdiscount' -q || /Users/jonan/.rvm/rubies/ruby-1.9.3-p385/bin/ruby -S gem install rdiscount -v '~> 1.6' --no-ri --no-rdoc
Building native extensions. This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
/Users/jonan/.rvm/rubies/ruby-1.9.3-p385/bin/ruby -S gem list ronn -v '~> 0.7.3' | grep 'ronn' -q || /Users/jonan/.rvm/rubies/ruby-1.9.3-p385/bin/ruby -S gem install ronn -v '~> 0.7.3' --no-ri --no-rdoc
Fetching: hpricot-0.8.6.gem (100%)
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing ronn: