Skip to content

Instantly share code, notes, and snippets.

View sabman's full-sized avatar
😀
Building, Shiping, Sharing!

Shoaib Burq sabman

😀
Building, Shiping, Sharing!
View GitHub Profile
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@lwe
lwe / faker_ch.rb
Created August 11, 2009 11:26
Swiss-ify random data generated by faker
# make faker a bit more swiss-friendly :)
module Faker
class Company
# Add swiss suffixes like AG, GmbH etc.
def self.suffix
%w(AG GmbH und\ Söhne und\ Partner &\ Co. Gruppe LLC Inc.).rand
end
end
@ghickman
ghickman / _contact.rb
Created July 4, 2010 17:23
Jekyll Contact Form with Sinatra
require 'rubygems'
require 'sinatra'
require 'pony'
require 'haml'
set :haml, {:format => :html5}
set :public, File.dirname(__FILE__)
set :views, File.dirname(__FILE__)
# Create the page class and give it a title of Contact for the layout
@eventualbuddha
eventualbuddha / seed_file.rb
Created July 9, 2010 01:51
SeedFile, a helper for doing database setup in a Rails 3 app
# Helper class for importing files with records to the database.
class SeedFile
def self.import(path)
new(path).import
end
attr_reader :path
def initialize(path)
@path = Pathname(path)
CURRENT_RUBY = 'ree-1.8.7-2010.02'
RUBY_PATH = "/home/rails/.rvm/rubies/#{CURRENT_RUBY}"
GEM_HOME = "/home/rails/.rvm/gems/#{CURRENT_RUBY}"
ssh_options[:paranoid] = false
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :stages, %w(staging production)
@RandomEtc
RandomEtc / albers.js
Created July 14, 2010 23:18
An Albers Equal Area Conic projection in javascript, for protovis.
/*
An Albers Equal Area Conic projection in javascript, for protovis.
For centering the contiguous states of the USA in a 800x400 div, I used:
var scale = pv.Geo.scale(albers(23, -96, 29.5, 45.5))
.range({ x: -365, y: -375 }, { x: 1200, y: 1200 });
http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
@kashif
kashif / gdal.rb
Created July 21, 2010 13:10 — forked from sabman/gdal.rb
require 'formula'
class Gdal <Formula
url 'http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz'
homepage 'http://www.gdal.org/'
md5 '05351f8cb61761ae579667e24a297fe6'
def options
[
['--with-pg', "Include PostgreSQL support."],
require 'formula'
class Geos <Formula
url 'http://download.osgeo.org/geos/geos-3.2.2.tar.bz2'
homepage 'http://trac.osgeo.org/geos/'
md5 'c5d264acac22fe7720f85dadc1fc17c6'
def options
[
['--enable-python', "Enable build of python module."],
@gerad
gerad / install-openinviter-ubuntu.md
Created September 15, 2010 05:45
setup openinviter on ec2

setup the instance

locally

go to the amazon web interface

note your AWS_USER_ID in the upper right hand corner. create a new AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

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