Skip to content

Instantly share code, notes, and snippets.

View marks's full-sized avatar

Mark Silverberg marks

View GitHub Profile
We couldn’t find that file to show.
task :export do
require 'sequel'
require 'fastercsv'
db = Sequel.connect(ENV['DATABASE_URL'])
table_name = ENV['table'].to_sym
table = db[table_name]
fields = table.first.keys
# SELECT * FROM employees
# WHERE ( salary > 10000 )
# AND ( name = 'Jamis' ))
# LIMIT 10
# Will be written as
Employee.with_scope(
:find => { :conditions => "salary > 10000",
:limit => 10 }) do
Employee.find(:all)
<!-- START Mark's [Sub]Page Tree Drop Down Box -->
<form action="<?php bloginfo('url'); ?>" method="get">
<?php wp_dropdown_pages(array(
'depth' => 0,
'child_of' => 0,
'selected' => $post->ID,
'echo' => 1,
'name' => 'page_id' )); ?>
<input type="submit" name="submit" value="Go" />
</form>
@marks
marks / sandbox.yml
Created July 19, 2009 15:06
adhearsion sandbox component
username: XXXX
password: XXXX
connect_to:
host: sandbox.adhearsion.com
port: 20000
#record in dialplan.rb
thread = Thread.new do
#do stuff
end
thread.join
[agents]
exten => _XXXXXXX,2,Dial(${PSTN_TRUNKS}/1512${EXTEN}||iM(ackcall))
[macro-ackcall]
exten=>s,1,Wait(.8)
exten=>s,2,Set(TIMEOUT(absolute)=12)
exten=>s,3,Read(ACCEPT|mcc-agent-ackcall|1) ; "...Press zero to be connected with caller, or any number to leave the caller in queue..."
exten=>s,4,Gotoif($[${ACCEPT}=0]?50:30)
exten=>s,30,Set(MACRO_RESULT=CONTINUE) ;hangup!
exten=>s,50,Set(TIMEOUT(absolute)=0) ;connect!
require 'uri'
def remove_urls(text)
urls = URI.extract(text)
text.gsub(/#{urls}/, 'LINK')
end
puts remove_urls("check out my cool new video at my website at http://myspace.com/aesdf")
# POST TO http://api.tropo.com/1.0/sessions
# <session>
# <token>YOUR_TOKEN</token>
# <var name="customerName" value="Jose de castro" />
# <var name="numberToDial" value="8005195825" />
# <var name="message" value="Your laundry is ready for pickup at 189 S Orange Ave" />
# </session>
api_url = "http://api.tropo.com/1.0/sessions"
call_options.each do |key,value|
stack :margin => 10 do
para key
new_key = edit_line :text => value
end
end
### => new_caller = edit_line :text => value