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
{16:42}[ruby-1.9.2]~/Desktop ben% echo "This is text file one" > file1.txt | |
{16:43}[ruby-1.9.2]~/Desktop ben% echo "This is text file two" > file2.txt | |
{16:43}[ruby-1.9.2]~/Desktop ben% diff file1.txt file2.txt > something.diff | |
{16:43}[ruby-1.9.2]~/Desktop ben% mate something.diff | |
...or... | |
{16:43}[ruby-1.9.2]~/Desktop ben% diff file1.txt file2.txt | mate |
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
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
%w(cgi socket routing/helpers routing/config routing/romeo routing/inbound routing/token).each { |lib| require lib } | |
module Foo | |
def self.test | |
puts "test" | |
end | |
end | |
Foo.test |
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
set_caps "http://yourdomain.com[or something else unique to identify your software]", [{:name => "somename", :type => "bot", :category => "client"}], ["http://jabber.org/protocol/si/profile/file-transfer"] | |
send_caps |
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
# Copyright 2004-2005, @Last Software, Inc. | |
# This software is provided as an example of using the Ruby interface | |
# to SketchUp. | |
# Permission to use, copy, modify, and distribute this software for | |
# any purpose and without fee is hereby granted, provided that the above | |
# copyright notice appear in all copies. | |
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
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
source 'http://rubygems.org' | |
gem 'blather' | |
gem 'foreman' |
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
source 'http://rubygems.org' | |
gem 'blather' | |
gem 'foreman' |
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 'json' | |
require 'httparty' | |
require 'logger' | |
module TropoREST | |
@logger = Logger.new STDOUT | |
@logger.level = Logger::WARN | |
class << self | |
include HTTParty |
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
begin | |
# Some pre-call stuff | |
dial 'blah' | |
rescue Adhearsion::Hangup | |
# Some stuff we only do when hangup occurs | |
ensure | |
# Some after call stuff | |
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
def ready_to_call(times={}) | |
@timer ||= CumulativeTimer.new "#{RAILS_ROOT}/log/appointment_call_load_timing.txt" | |
@timer.dump | |
times = { :unconfirmed_start => Time.now - 4.hours, :unconfirmed_end => Time.now + 100.days - 4.hours, | |
:confirmed_start => Time.now - 4.hours, :confirmed_end => Time.now + 100.days - 4.hours }.merge times | |
uc_start, uc_end = times[:unconfirmed_start].to_i, times[:unconfirmed_end].to_i | |
c_start, c_end = times[:confirmed_start].to_i, times[:confirmed_end].to_i |
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
t = Time.now | |
[1,2,3].each do |n| | |
puts "Working on #{n}" | |
t_answer = false | |
while true | |
if ((Time.now - t) > 10) | |
puts "10 seconds elapsed" | |
t_answer = true | |
break | |
end |