Skip to content

Instantly share code, notes, and snippets.

View jlong's full-sized avatar
🚀

John W. Long jlong

🚀
View GitHub Profile
@ntalbott
ntalbott / hipchat-transcript
Created January 25, 2013 15:54
A handy little script to create a text-based transcript from a Hipchat room.
#!/usr/bin/env ruby
require "httparty"
def usage!
puts "Usage: hipchat-transcript <token> <room id> [date]"
exit!
end
TOKEN = (ARGV[0] || usage!)
@dhh
dhh / gist:981520
Created May 19, 2011 19:27
bulk api
# Bulk API design
#
# resources :posts
class PostsController < ActiveController::Base
# GET /posts/1,4,50,90
# post_url([ @post, @post ])
def show_many
@posts = Post.find(params[:ids])
end
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@eclubb
eclubb / sqlite2pg.sh
Created March 30, 2012 17:20
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session