Skip to content

Instantly share code, notes, and snippets.

View benlangfeld's full-sized avatar

Ben Langfeld benlangfeld

View GitHub Profile
{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
$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
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
# 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
source 'http://rubygems.org'
gem 'blather'
gem 'foreman'
source 'http://rubygems.org'
gem 'blather'
gem 'foreman'
require 'json'
require 'httparty'
require 'logger'
module TropoREST
@logger = Logger.new STDOUT
@logger.level = Logger::WARN
class << self
include HTTParty
begin
# Some pre-call stuff
dial 'blah'
rescue Adhearsion::Hangup
# Some stuff we only do when hangup occurs
ensure
# Some after call stuff
end
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
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