Skip to content

Instantly share code, notes, and snippets.

View schowdhury's full-sized avatar

Sameer Chowdhury schowdhury

View GitHub Profile
@krames
krames / location.rb
Created July 15, 2011 17:22
Playing around with Geocoder
require 'rubygems'
require 'sinatra'
require 'geocoder'
get '/' do
view
end
post '/locate' do
result = nil
module AcceptsDelimtedIdStringFor
# accepts_delimited_id_string_for :careers
#
# becomes
#
# def career_id_strings=(delimited_string)
# self.careers = Career.where(:id => delimited_string.split(",")).all
# end
#
@shapeshed
shapeshed / nginx_rails_3_1
Created October 10, 2011 19:13
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@ahoward
ahoward / nuke-attrs.rb
Created February 1, 2012 04:11
removing a bunch of mongo attributes in one hit #L19
class AddPageFields < Mongoid::Migration
def self.up
Account.all.each do |account|
account.pages.each do |page|
page.update_attributes!(
:callout => Account::Page::Defaults.callout,
:phone => Account::Page::Defaults.phone,
:email => Account::Page::Defaults.email
)
end
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@markbates
markbates / gist:4240848
Created December 8, 2012 16:06
Getting Started with Rack

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

@afeld
afeld / gist:4952991
Last active February 8, 2022 03:13
good APIs for mashups

This list has been superseded by Public APIs. Check there for APIs with Auth: No, HTTPS and CORS Yes.


List of data APIs that require no server-side auth or private credentials, and are thus good for small browser-only JS projects.