Skip to content

Instantly share code, notes, and snippets.

@tjmcewan
tjmcewan / gist:973035
Created May 15, 2011 10:41
compass/jammit pre-commit hook
#!/bin/sh
echo "Compiling styles with Compass..."
compass compile --quiet --trace
git add public/stylesheets
echo "Packaging assets with Jammit..."
jammit
git add public/assets
@tjmcewan
tjmcewan / database.yml
Created April 5, 2011 00:47
Rails agnostic database.yml
<%
app = "awesome_application"
mysql_version = case Rails.version.first.to_i
when 3 then 'mysql2'
when 2 then 'mysql'
else
raise 'Version not supported'
end
%>
@tjmcewan
tjmcewan / application_helper.rb
Created February 21, 2011 00:44
env-aware jQuery includes
def jquery_includes
jquery_version = "1.4.4"
jquery_ui_version = "1.8.9"
css_theme = "redmond"
if ::Rails.env == 'production'
proto = request.ssl? ? 'https://' : 'http://'
cdn_url = "ajax.googleapis.com/ajax/libs/jquery"
javascript_include_tag("#{proto}#{cdn_url}/#{jquery_version}/jquery.min.js") +
@tjmcewan
tjmcewan / bundle-updater.sh
Created March 22, 2010 02:38
pull multiple git repos from the directory above
# pull all git-based projects in the current directory (doesn't hurt non-git directories)
# for TextMate bundles: run this from [~]/Library/Application\ Support/TextMate/Bundles/
for repo in *; do if [ -d "$repo" ]; then cd "$repo"; git pull origin; cd ../; fi done