Skip to content

Instantly share code, notes, and snippets.

View revans's full-sized avatar
🤠
Building Businesses

Robert Evans revans

🤠
Building Businesses
View GitHub Profile
# Just drop this little diddy in your app to get some (not perfect) information on query times and such
# This will eventually become an official plugin but for those who can't wait, enjoy.
if defined?(NewRelic)
module MMNewRelicTracing
def self.included(model)
meths = %w[find find! paginate first last all count create create! update delete delete_all destroy destroy_all exists? find_by_id increment decrement set push push_all push_uniq pull pull_all]
model.metaclass.class_eval do
meths.each do |meth|
@revans
revans / gist:300764
Created February 10, 2010 19:45 — forked from mattb/gist:25502
$.getJSON('http://api.flickr.com/services/rest/?method=flickr.places.getInfo&api_key=get_your_own&woe_id=44418&format=json&jsoncallback=?', function(data) {
if(data.place.has_shapedata == 1) {
var bounds = new GLatLngBounds();
$.each(data.place.shapedata.polylines.polyline, function(index,polyline) {
thepoints = [];
$.each(polyline._content.split(/ /), function(pindex, point) {
lat = parseFloat(point.split(/,/)[0]);
lng = parseFloat(point.split(/,/)[1]);
thepoints[pindex] = new GLatLng(lat, lng);
});
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*
require 'minitest/unit'
require 'minitest/spec'
require 'ansi'
class MiniTest::Unit
include ANSI::Code
PADDING_SIZE = 4
def run(args = [])
@revans
revans / Bluepill Uncorn Config File
Created May 18, 2011 02:05
Bluepill used at Halftoneapp.com
#
# Halftoneapp.com Sample Bluepill Configuration File
# Read more at: http://blog.halftoneapp.com
#
# Set paths
home_dir = "/home/railsapp"
rails_shared = "#{home_dir}/app/shared"
unicorn_path = "/path/to/unicorn_rails"
@revans
revans / gist:1189555
Created September 2, 2011 19:13 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Code Wranglers
Favorite Python project: pystache
Favorite Conference: CodeConf
Python Experience Level: Beginner
@revans
revans / USAGE.md
Created September 12, 2011 15:01 — forked from kossnocorp/USAGE.md
MacVim with Drawer compile manual

Clone & Build

curl https://raw.github.com/gist/1211490/afc8c6ff2221fced522388a4220397c1a7c5ece3/build.sh | sh
@revans
revans / gist:1293745
Created October 17, 2011 20:47 — forked from fennb/gist:1283573
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@revans
revans / gems_install.rb
Created February 27, 2012 18:34 — forked from vvalgis/gems_install.rb
Install gems from a gem list dump
#!/usr/bin/env ruby
#gem_cmd = ENV["GEM_CMD"] || 'sudo gem'
gem_cmd = 'gem'
STDIN.map { |l| l.strip }.each { |l|
gem, versions = l.split(' ', 2)
versions = versions.gsub(/[\(\)]/, '').split(', ')
versions.each { |version|
cmd = "#{gem_cmd} install #{gem} -v #{version} --no-ri --no-rdoc"