Skip to content

Instantly share code, notes, and snippets.

View bsima's full-sized avatar
drinking coffee

Ben Sima bsima

drinking coffee
View GitHub Profile
# Deploying Sinatra apps to Amazon EC2 using rubber (normally used for Rails deployment to EC2)
#
# Rakefile needed by rubber for non-rails apps
#
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
env = ENV['RUBBER_ENV'] ||= (ENV['RAILS_ENV'] || 'development')
root = File.dirname(__FILE__)
@gorsuch
gorsuch / gist:1418850
Created December 1, 2011 18:37
clojure uuid
(defn uuid [] (str (java.util.UUID/randomUUID)))
@ttscoff
ttscoff / scrivwatcher.rb
Created January 25, 2012 15:05
Watch a Scrivener project for changes and update Marked.app
#!/usr/bin/ruby
# scrivwatch.rb by Brett Terpstra, 2011
# Modifications to merge into one file for Markdown viewing in Marked by BooneJS, 2012
# Modified to use REXML and add titles by Brett Terpstra, 2012 <https://gist.github.com/1676667>
#
# Watch a Scrivener project for changes and update a preview file for Marked
# Usage: scrivwatch.rb /path/to/document.scriv
# <http://markedapp.com>
require 'fileutils'
@boucher
boucher / gist:1750368
Created February 6, 2012 07:07 — forked from saikat/gist:1084146
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@boucher
boucher / gist:1750375
Created February 6, 2012 07:09 — forked from siddarth/gist:1379745
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@ericmoritz
ericmoritz / bbeat.clj
Created March 2, 2012 16:09 — forked from damionjunk/gist:1500336
Binaural Beats with Overtone and Clojure
(ns overtone-clj-toys.binaural
(:use [overtone.live]))
;;
;; Binaural Beat Synthesis:
;; Generates binaural beats given the provided carrier and desired
;; frequency. Brown noise is used to soften the background and
;; block out outside noise.
;; freq effect
@MicahElliott
MicahElliott / rbenv-howto.md
Created April 17, 2012 18:11
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@igrigorik
igrigorik / load.rb
Created April 20, 2012 06:34
load githubarchive data into sqlite3 database
#
# $> ruby load.rb http://data.githubarchive.org/2012-04-01-15.json.gz
#
require 'yajl'
require 'zlib'
require 'sqlite3'
require 'open-uri'
input = ARGV.shift
;; you are starting here
(fn [x & xs]
(fn [& args]
((fn step [[f & fs] a]
(if fs
(f (step fs a))
(apply f a)))
(cons x xs) args)))
@kix
kix / cap.rb
Created October 5, 2012 08:04
Capistrano cheat sheet
http://www.dizzy.co.uk/cheatsheets
This work is licensed under the Creative Commons
Attribution-NonCommercial-NoDerivs 2.0 License. To
view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-nd/2.0/uk
########## Shell Commands ##########
Installation:
$ gem install capistrano