Skip to content

Instantly share code, notes, and snippets.

View stevenscg's full-sized avatar

Chris Stevens stevenscg

View GitHub Profile
@solso
solso / sentiment_api.rb
Created May 9, 2012 15:09
Active Docs for the Sentiment API (based on the Swagger specification)
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'sinatra'
require './analyzer.rb'
class SentimentApi < Sinatra::Base
disable :logging
disable :raise_errors
disable :show_exceptions
@broox
broox / Haversine.md
Created April 15, 2012 15:56
Haversine Distance Formulas

Haversine Formula

used to calculate the great circle distance between two points on the earth (specified in decimal degrees)

Earth's Radius

  • Miles: 3956
  • Kilometers: 6371

Javascript

@nhoffmann
nhoffmann / deploy.rb
Created April 3, 2012 14:07
Capistrano recipe for deploying static content.
set :application, "My Static Content"
set :servername, 'test.example.com'
# no git? simply deploy a directory
set :scm, :none
set :repository, "." # the directory to deploy
# using git? deploy from local git repository
# set :scm, :git
# set :repository, 'file//.' # path to local git repository
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@aaronksaunders
aaronksaunders / parse.js
Created March 24, 2012 05:07
Titanium Appcelerator Quickie: Parse API : parse.js
//Public client interface
function Client(applicationId, masterKey) {
this.applicationId = "applicationId";
this.masterKey = "masterKey";
}
exports.Client = Client;
//Parse API endpoint
var ENDPOINT = 'https://api.parse.com/1/classes/';
@drawks
drawks / graphite
Created February 14, 2012 21:24
Graphite on uwsgi/nginx
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
@tcz
tcz / gist:1746180
Created February 5, 2012 15:50
MySQL backup with innobackupex and s3cmd
#!/bin/bash
INNOBACKUP="/root/percona-xtrabackup/innobackupex"
INNOBACKUP_OPTIONS="--defaults-file=/etc/my.cnf --ibbackup=/root/percona-xtrabackup/mysql-5.5/storage/innobase/xtrabackup/xtrabackup_innodb55 --parallel=4 --user=root --password=XXXXXXX"
BACKUPDIR="/var/sqlbackup/"
S3BUCKET="db_backup"
echo "Removing old local backups"
cd $BACKUPDIR
@ziadoz
ziadoz / awesome-php.md
Last active February 3, 2025 20:55
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@voidfiles
voidfiles / actionQueue.js
Created November 27, 2011 19:42
actionQueue
(function(A) {
var registered_ids = {},
id_to_module_map = {},
interim_actions = {},
cleanup_actions = {},
clicked_ids = {},
queueing = {};
function register_id(id, callbacks, required_module) {
id = id.replace('*', '.*');