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
| 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 |
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
| # 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) |
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
| <!-- 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> |
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
| username: XXXX | |
| password: XXXX | |
| connect_to: | |
| host: sandbox.adhearsion.com | |
| port: 20000 |
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
| #record in dialplan.rb | |
| thread = Thread.new do | |
| #do stuff | |
| end | |
| thread.join |
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
| [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! |
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 '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") |
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
| # 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" |
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
| 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 |