This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using rvm with ruby-1.8.7-p249 | |
# latest version 2.7.88 | |
brew install libxml2 | |
# installing libxslt from source code | |
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz | |
tar xvfz libxslt-1.1.26.tar.gz | |
cd libxslt-1.1.26 | |
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A Revised Font Stack | |
from A Way Back | |
http://www.awayback.com/revised-font-stack/ | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MAKE SURE YOU HAVE VIRTUAL BOX INSTALLED http://www.virtualbox.org/wiki/Downloads | |
# | |
# Copy paste this file in your terminal | |
# The following will create a dir which contains the rails repo. | |
# You can start edit this later on. It will also create a Gemfile and a Vagrantfile. | |
# It will run bundle and it will # download and activate the virtualbox that contains | |
# everything you need to start # testing. | |
mkdir rails_test_box | |
cd rails_test_box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Capistrano Deploy Recipe for Git and Phusion Passenger | |
# | |
# After issuing cap deploy:setup. Place server specific config files in | |
# /home/#{user}/site/[staging|production]/shared | |
# Set :config_files variable to specify config files that should be | |
# copied to config/ directory (i.e. database.yml) | |
# | |
# To deploy to staging server: | |
# => cap deploy | |
# => Deploys application to /home/#{user}/site/staging from master branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HTML | |
class StathamSanitizer < WhiteListSanitizer | |
protected | |
def tokenize(text, options) | |
super.map do |token| | |
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name) | |
token.to_s.gsub(/</, "<") | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Inspired by | |
# http://dev.rubyonrails.org/svn/rails/plugins/account_location/lib/account_location.rb | |
# | |
module SubdomainAccounts | |
def self.included( controller ) | |
controller.helper_method(:account_domain, :account_subdomain, :account_url, :current_account, :default_account_subdomain, :default_account_url) | |
end | |
protected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How-to set up a multi-site environment like the one in doodlekit.com | |
# every top-level object has a site_id | |
# The sites table holds all the information for each site, including the name, and what I call a 'handle'. | |
# The handle is used for many things, but mainly for the sub-domain. | |
# There is a separate field for the domain # name, so that we can support both the sub-domain, and a custom domain name at the same time. | |
# For every request a before_filter runs which looks something like this: | |
def load_site | |
if request.domain == DOODLEKIT_DOMAIN | |
sub_domain = request.subdomains.last || 'default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app:sync | |
# Local and production synchronization | |
# - require yaml_db plugin | |
namespace :app | |
namespace :sync do | |
task :all => [:files, :db] | |
task :files do | |
`rsync -azv user@host:'/apps/myawesomeapp/shared/files/' #{Rails.root + 'files'}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/dns/resolver' | |
# Custom Domain | |
# | |
# Require net-dns gem | |
# | |
# A Rack middleware to to resolve the custom domain to original subdomain | |
# for your multi telent application. | |
# | |
# It's all transperant to your application, it performs cname lookup and |