Skip to content

Instantly share code, notes, and snippets.

View carpeliam's full-sized avatar
👋
say hi!

Liam Morley carpeliam

👋
say hi!
View GitHub Profile
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
# Template which configures a generic Rails app with Shoulda, Factory Girl,
# HAML, etc while commiting each step into git.
#
# Make sure you have Rails 2.3rc1 or greater installed and run:
# rails -d mysql -m http://gist.github.com/raw/57458/06345c42a92048e699af3140ccd28bbcd8915bc5/archfear.rb my_app
# Helper methods
def environment(data = nil, options = {}, &block)
options = { :sentinel => 'Rails::Initializer.run do |config|' }.merge(options)
module DealsHelper
def render_deals
Deal.all.collect do |deal|
content_tag :div, :class => 'deal' do
image_tag(deal.photo_url)
content_tag :h3, deal.title, :class => 'title'
content_tag :p, deal.full_price, :class => 'full_price'
content_tag :p, deal.selling_price, :class => 'selling_price'
content_tag :p, deal.discount, :class => 'discount'
content_tag :p, deal.store.name, :class => 'store_name'
@carpeliam
carpeliam / pre-commit
Last active August 29, 2015 14:06 — forked from eedrummer/pre-commit
#!/bin/sh
#
# To enable this hook, rename this file to "pre-commit".
PRY_PATTERN="require.+[\'\"]pry[\'\"]|binding\.pry"
# Redirect output to stderr.
exec 1>&2
if git diff --cached | grep '^\+' | grep -q -E $PRY_PATTERN; then
echo "ERROR: There is left over pry stuff in this commit"