Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am smholloway on github.
  • I am sethholloway (https://keybase.io/sethholloway) on keybase.
  • I have a public key whose fingerprint is 04A6 233C 2F88 9B58 DB83 3332 0AFE B2CB 22AC 895A

To claim this, I am signing this object:

View is-polymorphism-faster-in-ruby.rb
# http://www.6blog.us/2013/02/is-polymorphism-faster-in-ruby/
#
# Testing the speed of polymorphism in Ruby. This program is based on the Wikipedia article:
# http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming
#
# To run: ruby main.rb <number of runs to time (optional)>
# Example: ruby main.rb 5
class Animal
def initialize(name)
View toopher-authentication-json-response-example.js
{
"action": {
"created": "2015-01-01 10:10:10",
"id": "12345678-1234-4123-8123-1234567890ab",
"modified": "2015-01-01 10:10:10",
"name": "log in",
"requester": {
"consumer": {
"key": "key"
},
View toopher-php-pairing-example.php
require_once("toopher_api.php");
// Create an API object using your credentials
$toopherApi = new ToopherAPI($key, $secret);
// Step 1 - Pair with their phone's Toopher app
$pairing = $toopherApi->pair("pairing phrase", "username@yourservice.com");
View toopher-java-authentication-example.java
import com.toopher.*;
// Create an API object using your credentials
ToopherApi api = new ToopherApi("<your consumer key>", "<your consumer secret>");
// Step 2 - Authenticate a log in
AuthenticationStatus auth = api.authenticate(pairing.id, "my computer");
// Once they've responded you can then check the status
AuthenticationStatus status = api.getAuthenticationStatus(auth.id);
View toopher-php-authentication-example.php
require_once("toopher_api.php");
// Create an API object using your credentials
$toopherApi = new ToopherAPI($key, $secret);
// Authenticate a log in
$authStatus = $toopherApi->authenticate($pairingStatus['id'], "my computer");
// Once they've responded you can then check the status
while($authStatus['pending']){
View toopher-ruby-pairing-example.rb
require 'toopher_api'
# Create an API object using your credentials
toopher = ToopherAPI.new("key", "secret")
# Step 1 - Pair with their phone's Toopher app
pairing = toopher.pair("pairing phrase", "username@yourservice.com")
View toopher-ruby-authentication-example.rb
require 'toopher_api'
# Create an API object using your credentials
toopher = ToopherAPI.new("key", "secret")
# Authenticate a log in
auth_status = toopher.authenticate(pairing.id, 'my computer')
# Once they've responded you can then check the status
auth_status = toopher.get_authentication_status(auth_status.id)
View toopher-perl-pairing-example.pm
use ToopherAPI
# Create an API object using your credentials
my $api = new ToopherApi("<your consumer key>", "<your consumer secret>");
# Step 1 - Pair with their phone's Toopher app
my $pairing_status = $api->pair("pairing phrase", "username@yourservice.com");
View toopher-java-pairing-example.java
import com.toopher.*;
// Create an API object using your credentials
ToopherApi api = new ToopherApi("<your consumer key>", "<your consumer secret>");
// Step 1 - Pair with their phone's Toopher app
PairingStatus pairing = api.pair("pairing phrase", "username@yourservice.com");