Instantly share code, notes, and snippets.

View gist:adf164d8a9f271029ec0

Show Hidden:

defaults write AppleShowAllFiles -boolean true ; killall Finder

and to hide them:

defaults write AppleShowAllFiles -boolean false ; killall Finder

View gist:7345969

Command line shortcut: Hide or show hidden system files in OS X Mavericks

Add the following in your ~./bash_profile

# Show hidden files in Finder
alias showsystem=”defaults write AppleShowAllFiles TRUE”
# Hide hidden files in Finder
alias hidesystem=”defaults write AppleShowAllFiles FALSE”
View sprites.js
// Source code from blog post: Node.js w/1M concurrent connections!
// By Aaron “Caustik” Robinson
// includes
var cluster = require('cluster');
var cpuCount = require('os').cpus().length;
var util = require("util");
var http = require("http");
View pingpong.rb
x = ''
x += 'ping' if i%5==0
x += 'pong' if i%7==0
puts(x.empty? ? i : x);
View server.js
var express = require('express');
var app = express();
app.set('port', 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
//session & cookie
View .gitignore
View google_calendar.rb
# Google Calendar access w/ Data API
# OAuth authentication.
require "sinatra"
require "excon"
require "cgi"
require "base64"
require "openssl"
require "digest/hmac"
require "json/pure"

I had issues installing Postgres with the instructions in this Railscast. However I was able to get postgres running on my project with and (Hat tip to this stackoverflow thread).

  1. Download & install (documentation) Make sure to install in /Applications.
  2. Update your PATH
    In my case I added the following to ~/.bash_profile
    export PATH="/Applications/$PATH"
    Check that is being loaded
$ which psql
View gist:2940467
require "httparty"
require "redis"
require_relative "../models/twitter_status" # some wrapper for a Twitter status
class TwitterStream
attr_reader :twitter_handle, :tweets
attr_reader :cache # a helper to the Redis database
attr_reader :cached_response # the actual response from a API call
that is put into the cache
View gist:2940456
require 'rubygems'
require 'sinatra'
require 'httparty'
class Representative
include HTTParty
get '/' do
erb :form
get '/:username' do