Skip to content

Instantly share code, notes, and snippets.

View JonCrawford's full-sized avatar
🏗️
Helping startups on product, tech & UX

Jonathan Crawford JonCrawford

🏗️
Helping startups on product, tech & UX
View GitHub Profile
@JonCrawford
JonCrawford / product_showcase.css
Created June 27, 2011 01:26
Storenvy Product Showcase Slider - This code is provided as-is and is not supported by Storenvy.
/* Add this CSS to your store Styles section under CSS mode */
/* http://www.storenvy.com/ */
/* Photo Slider */
.product_photo_slider {
background: #fff; /*: Product Slider Background :*/
border: 5px solid #eaeaea; /*: Product Slider Border :*/
color: #555; /*: Product Slider Product Description :*/
display: block;
margin-left:8px;
class VisitorStats
def initialize
@redis = Redis.new
end
# every time there's a hit, increment a counter for the
# day and week, and add the session id to a set of unique
# vistitors for the day/week
def hit(session_id)
today = Date.today
class Liquid::Strainer
def is_haml?; false; end
def controller
@controller ||= @context.registers[:controller]
end
delegate :request, :to => :controller
delegate :params, :to => :request
end
def index
@assets = current_account.assets.paginate :page => params[:page], :per_page => 10
end
# How to spec this???
before(:each) do
@account = Account.new
@assets = [Asset.new(:account => @account)]
end
it "should paginate the assets"
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
# needed to get spork/rspec running under snow leopard
# edit line 12 of rspec-1.2.8/lib/spec/runner/drb_command_line.rb
# was
# DRb.start_service("druby://localhost:0")
# should be
DRb.start_service("druby://127.0.0.1:0")
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
@JonCrawford
JonCrawford / gist:44415
Created January 7, 2009 20:45 — forked from anonymous/gist:44410
Improved! A slight alteratiion of DHH's dynamic subdomain technique.
# 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