Skip to content

Instantly share code, notes, and snippets.

View elcontrastador's full-sized avatar

Tyler Arrigoni elcontrastador

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>OneInterface.net Network Engineering, Inc. - About</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style>
#main { width:940px; height:840px; color:#fff; }
#content .row-1 {height:280px; background-color:#333;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test Doc</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style>
#main { width:940px; height:840px; color:#fff; }
#content .row-1 {height:280px; background-color:#333;}
# Using Rails 3.0.0, mri 1.9.2p0, shoulda 2.11.3
# Problem: shoulda validate_format of passes with any value in .with()
class CablingUnderTestTest < ActiveSupport::TestCase
should belong_to(:test_result)
should validate_format_of(:pass_fail).with(/^(PASS|FAIL)$/).
with_message(/^Must be 'PASS' or 'FAIL'$/)
# test_resuls.yml
<% sourcexml = "" %>
<% File.open('../../lib/test_data/trpe.xml').each_line {|l| sourcexml += l} %>
passing_test_example:
xmlsource: <%= sourcexml.safe_html %>
# test output from TestResults unit test
1) Error:
test: A TestResult instance should respond to method xmlsource and xmlsource=. (TestResultTest):
[test_adhearsion]
exten => 999,1,AGI(agi://192.168.1.64)
exten => 999,n,Hangup
;exten => s,1,AGI(agi://192.168.1.64)
[default]
include => test_adhearsion
;
; By default we include the demo. In a production system, you
redii-mbpro:dog tyler$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.4.0]
#ahn v1.0.0 - startub.rb
config.asterisk.enable_ami :host => "192.168.1.65", :username => "ahn_ami", :password => "testsecret", :events => true
#dialplan.rb
test_adhearsion {
play "hello-world"
#simon_game
;;; extensions.conf
[default]
exten => 1001,1,Answer()
exten => 1001,2,Playback(hello-world)
exten => 1001,3,Hangup()
exten => 2000,1,Dial(SIP/2000,5)
exten => 2000,2,VoiceMail(2000,u)
mbp-linux*CLI> sip set debug on
SIP Debugging enabled
mbp-linux*CLI>
<--- SIP read from UDP:192.168.1.64:43533 --->
<------------->
mbp-linux*CLI>
<--- SIP read from UDP:192.168.1.64:59247 --->time
[lib (master)]$ irb
ruby-1.9.2-p180 :001 > require 'ip'
=> true
ruby-1.9.2-p180 :002 > ip = IP.new('10.10.10.10/24')
=> #<IP:0x000001012bde30>
ruby-1.9.2-p180 :003 > ip.to_s
=> "#<IP:0x000001012bde30>"
ruby-1.9.2-p180 :004 > ip.methods
=> [:nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :__id__, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
ruby-1.9.2-p180 :005 > ip.methods.grep(/network/)
Feature: The Backup Extension
When a backup runs, files that require backing up are copied from the working
share to a 'retain' share with a new unique extension appended. It is
necessary for the file to be renamed during the copy to ensure the file is:
* unique so it will not overwrite the existing files or prior version of self
* easily associated with the original and prior backup files
* not dependant on the filesystem mtime/ctime for determining its creation
date and time
* capable of being subsequently parsed back into a ruby Time obj with same