Skip to content

Instantly share code, notes, and snippets.

@dbarison
dbarison / gist:1391050
Created November 24, 2011 10:28
Rails 3.1 application.rb asset pipeline
config.assets.precompile = [
/\.(?!css|js)\w+$/,
/application.(css|js)$/,
/admin.(css|js)$/,
'print.css', 'admin_print.css', 'ie.css', 'admin_ie.css', 'modernizr.js'
]
@dbarison
dbarison / gist:1476750
Created December 14, 2011 14:18
Google analyitics intelligence for ecommerce
- if controller.controller_name == 'orders' && controller.action_name == 'show'
- items = []
- @order.cart.line_items.each do |line_item|
- items << "_gaq.push(['_addItem',
'#{escape_javascript(@order.code)}',
'#{escape_javascript(line_item.product.code)}',
'#{escape_javascript(line_item.name)}',
'#{escape_javascript(line_item.product.category.name)}',
'#{escape_javascript(line_item.selling_price.to_s)}',
'#{escape_javascript(line_item.quantity.to_s)}']);"
@dbarison
dbarison / default.vcl.pl
Created June 14, 2012 15:37 — forked from bmarini/default.vcl.pl
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="blog"; // Database name
$tbl_name="posts"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
$(document).ready(function () {
$('iframe[src*="youtube.com"]').each(function () {
var sVideoURL = $(this).attr('src');
if (sVideoURL.indexOf('rel=0') == -1) {
$(this).attr('src', sVideoURL + '?rel=0');
}
});
});
//
// Variables
// --------------------------------------------------
// Global values
// --------------------------------------------------
// Grays
// -------------------------
// Core variables and mixins
//@import "twitter/bootstrap/variables";
@import "variables";
@import "twitter/bootstrap/mixins";
// Reset
@import "twitter/bootstrap/normalize";
@import "twitter/bootstrap/print";
source 'https://rubygems.org'
gem "rails", "2.3.14"
gem 'mysql2', "0.2.6"
gem "flickraw"
gem 'searchlogic', '2.4.27'
gem 'friendly_id', '3.2.0'
gem 'hpricot'
GEM
remote: https://rubygems.org/
specs:
actionmailer (2.3.14)
actionpack (= 2.3.14)
actionpack (2.3.14)
activesupport (= 2.3.14)
rack (~> 1.1.0)
activerecord (2.3.14)
activesupport (= 2.3.14)
-------------------------------------
Advanced Web Ranking Installation
-------------------------------------
[1] Basic (Advanced Web Ranking and Advanced Link Manager)
[2] Basic + Advanced Web Ranking Server
[3] Basic + Advanced Link Manager Server
[4] Complete
=======================
Enter your menu choice [1-4] (default [1])2
Start install