This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VOICE="Vicki" | |
BALANCE="100" | |
function voice_prompt () { | |
echo " SPEAKING: $1" | |
say -v "$VOICE" "$1" | |
} | |
function get_user_keypress () { | |
KEY="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TwillioController < ApplicationController | |
def digits | |
params['Digits'] | |
end | |
def twaction m | |
"http://snapclean.me:3000/twillio/#{m.to_s}" | |
end | |
def send_back &block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WEBSITE_SUBDIR = 'twilio-app' | |
require "#{WEBSITE_SUBDIR}/config/environment" | |
use Rails::Rack::LogTailer | |
use Rails::Rack::Static | |
run ActionController::Dispatcher.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn security-providers-type-algorithm-seq [] | |
(mapcat (fn [provider] | |
(map (fn [svc] | |
[(.getType svc) (.getAlgorithm svc)]) | |
(.getServices provider))) | |
(java.security.Security/getProviders))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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%;} |