Skip to content

Instantly share code, notes, and snippets.

View kyleburton's full-sized avatar

Kyle Burton kyleburton

View GitHub Profile
@kyleburton
kyleburton / mvn-clj-runner.sh
Created November 29, 2010 19:41
Maven / Clojure Bash Script for running a compiled class.
function project_dir () {
if [ -z "${PROJECT_DIR:-}" ]; then
abspath=$(cd ${0%/*} && echo $PWD/${0##*/})
path_only=$(dirname "$abspath")
path_only=$(dirname "$path_only")
path_only=$(dirname "$path_only")
PROJECT_DIR="$path_only"
export PROJECT_DIR
fi
@kyleburton
kyleburton / simple-ivr-simulator.sh
Created February 16, 2011 21:04
Simple IVR Simulator for testing out user experience (Works on OSX)
VOICE="Vicki"
BALANCE="100"
function voice_prompt () {
echo " SPEAKING: $1"
say -v "$VOICE" "$1"
}
function get_user_keypress () {
KEY=""
@kyleburton
kyleburton / abtab-examples.sh
Created February 17, 2011 15:00
Examples of using the Abstract Tables command line utilities
user@host ~$ gem install abstract-tables
# convert csv file to an Excel Spreadsheet:
user@host ~$ atcat your-file.csv xls://your-file.xls
# dump a table into an Excel Spreadsheet:
user@host ~$ atcat atcat dbi://pg/localhost/the_database_name/some_table xls://some-table.xls
# dump a list of tables into an Excel Spreadsheet:
user@host ~$ atcat dbi://pg/localhost/the_database_name xls://tables-and-rowcounts.xls
@kyleburton
kyleburton / twilio_ivr_prototype.rb
Created February 17, 2011 23:52
Better IVR Protoype: using twilio
class TwillioController < ApplicationController
def digits
params['Digits']
end
def twaction m
"http://snapclean.me:3000/twillio/#{m.to_s}"
end
def send_back &block
@kyleburton
kyleburton / config.ru
Created February 20, 2011 19:15
Twilio In 10 Minutes Heroku App Configuration
WEBSITE_SUBDIR = 'twilio-app'
require "#{WEBSITE_SUBDIR}/config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
@kyleburton
kyleburton / swank-runner.sh
Created March 9, 2011 14:02
Attempts to run Swank regardless of project type (Lein, Maven).
function swank () {
PORT="${1:-4005}"
if [ -e project.clj ]; then
slime-connect & ## see gist: https://gist.github.com/866324
lein deps; lein swank "$PORT"
elif [ -e pom.xml ]; then
slime-connect &
if [ -e patch.dev.pom.xml.patch ]; then
cp pom.xml dev.pom.xml
patch -p0 < patch.dev.pom.xml.patch
@kyleburton
kyleburton / slime-connect.rb
Created March 11, 2011 18:28
Emacs, Slime Helper to augment 'swank' bash function and trigger emacs to connect to the fresh swank server.
#!/usr/bin/env ruby
require 'socket' # Sockets are in standard library
$hostname = 'localhost'
$port = (ARGV[0] || "4005").to_i
attempts = 100
$s = nil
$retry = true
while $retry && (attempts > 0)
@kyleburton
kyleburton / twilio-ivr.rb
Created March 28, 2011 18:44
Example Twilio IVR State Machine
require 'ivrflow'
class CCard < Ivrflow
attr_accessor :asked_for_card_times
desc <<-END
This workflow represents a caller registering a Credit Card.
During the registration, after they've entered their credit
card number, we attempt to upsel them on
END
@kyleburton
kyleburton / java-sec-providers.clj
Created May 24, 2011 19:42
Clojure Java Security - enumerate providers, types and algorithms
(defn security-providers-type-algorithm-seq []
(mapcat (fn [provider]
(map (fn [svc]
[(.getType svc) (.getAlgorithm svc)])
(.getServices provider)))
(java.security.Security/getProviders)))
@kyleburton
kyleburton / oocssgrid-gen.rb
Created May 25, 2011 15:47
OOCSS Grids, generate additional sizings (eg: size1of10)
# ruby oocssgrid-gen.rb 10
# prints:
# .size1of10{width:10.0%;}
# .size2of10{width:20.0%;}
# .size3of10{width:30.0%;}
# .size4of10{width:40.0%;}
# .size5of10{width:50.0%;}
# .size6of10{width:60.0%;}
# .size7of10{width:70.0%;}
# .size8of10{width:80.0%;}