Skip to content

Instantly share code, notes, and snippets.

View metavida's full-sized avatar

Marcos Wright-Kuhns metavida

View GitHub Profile
@metavida
metavida / embed_the_web.html
Last active December 17, 2015 23:19
Sample HTML code that a teacher might paste into a Haiku Learning Embed the Web™ block, and an example of the contents of the JS file, which will pass the login of the current user on to the widget.php page.
<script type="text/javascript" src="https://your.domainna.me/path/to/widget.js">
@metavida
metavida / sync_phase1_part1.diagram
Last active December 16, 2015 22:59
Sequence diagrams describing possible data synchronization methods. You can visualize these using http://www.websequencediagrams.com
# Syncronization Sequence (Phase 1)
User->App: Open & Login
App->Server: GET ToDos
Server->App: 200 OK\n{title:eat breakfast, updated:02:00}
Web->Server: Update ToDo #1 via web at 02:30\n{title:eat lunch}
User->App: Update ToDo #1 in app at 03:00
App->Server: PUT update ToDo #1\n{title:eat dinner}
note over Server
The web changes are overwritten
@metavida
metavida / after_cd_hitch
Last active December 11, 2015 22:18
A handy rvm hook so that hitch automatically loads whenever you cd into an rvm project directory.
#!/usr/bin/env bash
# Add this file to your ~/.rvm/hooks/ directory to auto-initiate hitch
# whenever you cd into a project where the hitch gem is installed in the current rvm gemset.
if [[ -r ./.rvmrc && -n $(which hitch) && -x $(which hitch) ]]; then
echo 'Starting hitch'
hitch
fi
@metavida
metavida / .bash_login
Created April 21, 2011 18:04
A script that tweaks the Firefox bundle in OS X to always launch with a specified profile.
# Make your life even easier by adding this line to your .bash_login (or equivalent) file.
alias firefox-bin-profile='~/.bash_profile_scripts/firefox-bin-profile.rb'
@metavida
metavida / gist:925985
Created April 18, 2011 19:23
How to list a User's Roster records via the Haiku LMS API, using Ruby.
require 'rubygems'
require 'oauth'
require 'xmlsimple'
# Create an OAuth Consumer with the appropriate API key and secret.
@consumer = OAuth::Consumer.new("api_key_EUNzNgVkrpFUFg", "api_secret_KBq6hTvjjvqAWOPz6c4WnQHN6jvkU8", { :site=>"https://my-domain.haikulearning.com" })
# Create an OAuth Access Token using your personal key and secret.
@access_token = OAuth::AccessToken.new(@consumer, "token_959b3659b65ddbb6f8552c3401", "secret_40ec1d3617e7f58811c2f1e4416dcf2f7")
@metavida
metavida / oembed_providers.rb
Created January 31, 2011 23:54
Registering providers with the ruby-oembed gem
require 'rubygems'
require 'oembed'
OEmbed::Providers.register(OEmbed::Providers::Youtube)
OEmbed::Providers.get("http://www.youtube.com/watch?v=2BYXBC8WQ5k").html #=> expected HTML
OEmbed::Providers.get("http://vimeo.com/19231255").html #=> An OEmbed::NotFound error
OEmbed::Providers.register(OEmbed::Providers::Vimeo)
OEmbed::Providers.get("http://vimeo.com/19231255").html #=> expected HTML
@metavida
metavida / .bash_login
Created December 9, 2010 19:34
The portion of my .bash_login doc that sets up gemdoc and gem open
# gemdoc via http://stephencelis.com/archive/2008/6/bashfully-yours-gem-shortcuts
# needs to happen
gemdoc() {
open $GEM_HOME/doc/`$(which ls) $GEM_HOME/doc | grep $1 | sort | tail -1`/rdoc/index.html
}
_completegemlist() {
local cmd=${COMP_WORDS[0]}
local subcmd=${COMP_WORDS[1]}
local cur=${COMP_WORDS[COMP_CWORD]}
@metavida
metavida / gist:601087
Created September 28, 2010 14:29
How to retrieve a Report record via the Haiku LMS API, using C#.
// Based on code from the following sources:
// * http://www.voiceoftech.com/swhitley/index.php/2009/03/twitter-oauth-with-net/
// * http://oauth.googlecode.com/svn/code/csharp/
// Note: if you're using mono the following command will compile this code `gmcs -r:System.Web.dll this_file.cs`
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Net;
@metavida
metavida / gist:601064
Created September 28, 2010 14:16
How to "Ping" the Haiku LMS API, using C#.
// Based on code from the following sources:
// * http://www.voiceoftech.com/swhitley/index.php/2009/03/twitter-oauth-with-net/
// * http://oauth.googlecode.com/svn/code/csharp/
// Note: if you're using mono the following command will compile this code `gmcs -r:System.Web.dll this_file.cs`
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Net;
@metavida
metavida / gist:601058
Created September 28, 2010 14:11
How to test OAuth with the Haiku LMS API, using C#.
// Based on code from the following sources:
// * http://www.voiceoftech.com/swhitley/index.php/2009/03/twitter-oauth-with-net/
// * http://oauth.googlecode.com/svn/code/csharp/
// Note: if you're using mono the following command will compile this code `gmcs -r:System.Web.dll this_file.cs`
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Net;