This file contains 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
function assertViewAction(viewClass, eventCallbackName, elementAccessorName, eventName, viewReference) { | |
it("should run the " + eventCallbackName + " action when the " + elementAccessorName + " gets a " + eventName + " event (assertViewAction)", function() { | |
var isPrototypal = eventCallbackName in viewClass.prototype; | |
if (isPrototypal) { | |
spyOn(viewClass.prototype, eventCallbackName); | |
} | |
var view = viewReference(); | |
if (!isPrototypal) { | |
spyOn(view, eventCallbackName); | |
} |
This file contains 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
var Base = { | |
extend: function(proto) { | |
function f() { | |
if (this.init) this.init.apply(this, arguments); | |
}; | |
f.prototype = proto; | |
return f; | |
} | |
}; |
This file contains 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
// Adding functions to the prototypes of Javascript "standard library" classes should | |
// never be done in code that will be released as a framework for others to use. You | |
// should only do it for the framework you build up on a web app that you have total | |
// control over. | |
var _ = require("underscore"); | |
function UnderscorePrototypeImporter(proto, functions) { | |
_.each(functions, function(fnName) { | |
proto[fnName] = function(/* Any number of args */) { |
This file contains 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
class BlackHole | |
instance_methods.each { |m| undef_method m unless m =~ /^__/ } | |
def method_missing(*a) self end | |
end | |
BlackHole.new.doesnt.care("much").about(:anything, :you, :do).okay? |
This file contains 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 'pp' | |
# Storing all variables in a Hash so they can be printed in | |
# a way that shows everything related to the calculation. | |
x = {} | |
x[:task_count] = 1_000 | |
x[:$task] = 0.01 | |
x[:task_redundancy] = 2 # How many different users must do task |
This file contains 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
#---------- | |
#Yahoo weather app using YQL/JSON | |
#---------- | |
require 'open-uri' | |
require 'json' | |
answer | |
say 'Welcome to the Ruby Yahoo weather reader' | |
options = { :choices => "[5 DIGITS]", |
This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'adhearsion' | |
require 'adhearsion/voip/asterisk/manager_interface' | |
class MyManagerInterface < Adhearsion::VoIP::Asterisk::Manager::ManagerInterface | |
def event_message_received(event) | |
puts "Got an event! #{event.inspect}" | |
end |
This file contains 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
class MyManagerInterface < Adhearsion::VoIP::Asterisk::Manager::ManagerInterface | |
def event_message_received(event) | |
if event.name.downcase == "newstate" | |
puts "Got a newstate event! #{event.inspect}" | |
end | |
end | |
end | |
MyManagerInterface.connect ...... |
This file contains 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
xenu /opt/sandbox-infrastructure/inbound_agi_tunnel % git pull | |
remote: Counting objects: 72, done. | |
remote: Compressing objects: 100% (62/62), done. | |
remote: Total 65 (delta 18), reused 0 (delta 0) | |
Unpacking objects: 100% (65/65), done. | |
From git@github.com:jicksta/sandbox-infrastructure | |
92a1e80..a206ec2 master -> origin/master | |
Updating 92a1e80..a206ec2 | |
Fast forward | |
.gitignore | 3 + |
This file contains 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
xenu /home/hubbard % cat .bash_history | |
ls | |
vim /etc/motd | |
sudo vim /etc/motd | |
exit | |
quit | |
adduser jicksta | |
passwd jicksta | |
adduser | |
sudo adduser |