Skip to content

Instantly share code, notes, and snippets.

@stilist
stilist / .bash_profile
Last active October 13, 2015 10:08
Bash stuff!
export EDITOR=nano
# http://git-blame.blogspot.com/2012/02/anticipating-git-1710.html
export GIT_MERGE_AUTOEDIT=no
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
###############################################################################
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@joho
joho / gist:3735740
Created September 17, 2012 05:40 — forked from rafaelss/gist:3700977
PostgreSQL 9.2 upgrade steps
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@pdarche
pdarche / open paths oauth2 sinatra implementation
Created July 28, 2012 20:27
This is a Sinatra route that handles authentication and access to the open paths api using the oauth2 gem
get '/op' do
consumer_key = 'key'
consumer_secret = 'secret'
url = 'https://openpaths.cc/'
now = Time.now
#instantiate client
client = OAuth2::Client.new(consumer_key, consumer_secret, :site => url)
#create token
@steveklabnik
steveklabnik / Gemfile
Created July 24, 2012 21:52
Hypermedia Proxy pattern in JSON
source :rubygems
gem 'sinatra'
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 19, 2025 05:13
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@stilist
stilist / Default (OSX).sublime-keymap
Last active October 6, 2015 15:18
Sublime Text 2 preferences
[
// Drawn from http://www.sublimetext.com/forum/viewtopic.php?f=2&t=7477#p31755
// Kills the annoying default of cmd-left jumping to the start of a line's
// code, rather than column 0.
{ "keys": ["super+left"], "command": "move_to", "args": {"to": "hardbol", "extend": false} },
{ "keys": ["super+right"], "command": "move_to", "args": {"to": "hardeol", "extend": false} }
]
@acwright
acwright / gist:1944639
Created February 29, 2012 21:40
Sinatra / ActionMailer / Sendgrid / Heroku
require 'sinatra'
require 'action_mailer'
class Mailer < ActionMailer::Base
def contact
mail(
:to => "[email protected]",
:from => "[email protected]",
:subject => "Test") do |format|
format.text
@jordan-brough
jordan-brough / gist:1926410
Created February 27, 2012 19:14
ruby count_by using group_by
# See http://jordan.broughs.net/archives/2012/07/enumerablecount_by-for-ruby
# Ruby >= 1.8.7 (incl 1.9.x)
module Enumerable
def count_by(&block)
Hash[group_by(&block).map { |key,vals| [key, vals.size] }]
end
end
@coderoshi
coderoshi / mongohq.rb
Created February 21, 2012 00:20
MongoHQ Ruby Connection
# gem install mongo bson_ext json
require 'rubygems' # if less than Ruby 1.9
require 'mongo'
require 'uri'
require 'json'
def get_connection
return @db_connection if @db_connection
db = URI.parse(ENV['MONGOHQ_URL'])
db_name = db.path.gsub(/^\//, '')