This file contains 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
# Example tutorial for collecting DTMF keypad digits while using | |
# text-to-speech (TTS). Tested on Cloudvox via AGI (Asterisk's | |
# phone call API) and Adhearsion Ruby library. | |
default { | |
execute 'swift', "%p" % "Please enter a number and we will tell you what it is when we are done talking." | |
# See if our talking was interrupted by DTMF, and if so, grab the digit | |
nums = variable('SWIFT_DTMF') | |
This file contains 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
# Example of a simple click-to-call script. Includes a trick showing how to | |
# create a module for dialplan helpers. Tested on Cloudvox via AGI (Asterisk's | |
# phone call API) and Adhearsion Ruby library. | |
local_config = YAML::load(File.read(File.dirname(__FILE__) + '/local_config.yml')) rescue {} | |
module DialplanHelper | |
attr_accessor :default_swift_voice | |
attr_accessor :default_outgoing_context | |
This file contains 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
# My current ~/.autotest | |
require 'autotest/redgreen' | |
require 'autotest/restart' | |
# Images from http://blog.ardes.com/2008/5/23/leopard-autotest-growl-and-bob-the-builder | |
AUTOTEST_IMAGE_ROOT = File.expand_path(File.join(ENV['HOME'], 'Pictures', 'autotest')) | |
module Autotest::Growl | |
def self.growl(title, msg, img, pri=0) |
This file contains 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 Foo | |
private | |
def self.hello | |
puts "hi" | |
end | |
end | |
Foo.hello # => "hi" | |
class Bar |
This file contains 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 Array | |
def second | |
self[1] | |
end | |
def third | |
self[2] | |
end | |
def forth |
This file contains 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
jQuery(function($){ | |
$(".default_text") | |
.focus(function(event){ | |
if(this.value == this.defaultValue) { | |
this.value = ""; | |
} | |
}) | |
.blur(function(event){ | |
if(this.value == "") { | |
this.value = this.defaultValue; |
This file contains 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
$ ./script/plugin install git://github.com/tobi/delayed_job.git | |
removing: /Users/eric/src/project/vendor/plugins/delayed_job/.git | |
Initialized empty Git repository in /Users/eric/src/project/vendor/plugins/delayed_job/.git/ | |
remote: error: /data/git/repositories/7/70/7b/79/taylorbarstow/delayed_job.git/objects: ignoring alternate object stores, nesting too deep. | |
remote: error: /data/git/repositories/2/27/f6/0c/artofmission/delayed_job.git/objects: ignoring alternate object stores, nesting too deep | |
remote: error: /data/git/repositories/7/f4/e9/79/dsander/delayed_job.git/objects: ignoring alternate object stores, nesting too deep. | |
remote: error: /data/git/repositories/0/8c/2c/dd/vandrijevik/delayed_job.git/objects: ignoring alternate object stores, nesting too deep. | |
remote: error: /data/git/repositories/2/25/2c/2b/dhh/delayed_job.git/objects: ignoring alternate object stores, nesting too deep. | |
remote: error: /data/git/repositories/1/1c/e1/f4/joshknowles/delayed_job.git/objects: ignoring alternate object |
This file contains 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 'rails_generator/secret_key_generator' | |
module TokenGenerator | |
def generate_token(size = 32, &validity) | |
constant = "#{self.class.name}#{id}" | |
generator = Rails::SecretKeyGenerator.new(constant) | |
begin | |
token = generator.generate_secret.first(size) | |
end while !validity.call(token) if block_given? |
This file contains 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 'rubygems' | |
require 'daemons' | |
RAILS_ROOT = File.expand_path(File.join(File.dirname($0), '..')) | |
options = { | |
:dir_mode => :normal, | |
:dir => File.join(RAILS_ROOT, %w(tmp pids)), |
This file contains 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
Capistrano::Configuration.instance(:must_exist).load do | |
# Lifted from: | |
# http://github.com/vigetlabs/viget_deployment/tree/master/recipes/campfire.rb | |
begin | |
require 'rubygems' | |
require 'uri' | |
require 'tinder' | |
namespace :campfire do | |
after "deploy", "campfire:notify" |