Skip to content

Instantly share code, notes, and snippets.

View steffentchr's full-sized avatar

Steffen Fagerström Christensen steffentchr

View GitHub Profile
#!/usr/bin/env ruby
# Demonstrates how access tokens/secrets can be retrieved by a non-signed reqest to http://twitter.com/oauth/access_token
# Based on http://github.com/jstewart/yammer4r/blob/master/bin/yammer_create_oauth_yml.rb
# Usage: ./twitter_test.rb -k CONSUMER_KEY -s CONSUMER_SECRET
require 'optparse'
require 'rubygems'
require 'oauth'
include_once 'HTTP/OAuth/Consumer.php';
require_once 'HTTP/OAuth.php';
require_once 'HTTP/OAuth/Consumer/Request.php';
require_once 'HTTP/Request2.php';
// Set up HTTP request
$httpRequest = new HTTP_Request2;
$request = new HTTP_OAuth_Consumer_Request;
$request->accept($httpRequest);
@steffentchr
steffentchr / Combination version (not pretty, but functional)
Created October 30, 2010 06:11
Example on how to embed and interact with 23 Video players via JA API through both Flash and HTML5
<div id="videoContainer"></div>
<script src="http://stream.umbraco.org/resources/um/script/swfobject/swfobject.js"></script>
<script>
function getFlexApp(appName) {
if (navigator.appName.indexOf ("Microsoft") !=-1) {
@steffentchr
steffentchr / Running the script.md
Created November 28, 2011 18:26
A script to loop through your Jaiku history and index+preserve it through Jaiku Archive (http://www.jaikuarchive.com). Usage: ./jaikuarchive.tcl <username>

To run the script, either do a...

tclsh jaikuarchive.tcl marks

... or for the more pure way, opt for:

chmod +x jaikuarchive.tcl

./jaikuarchive.tcl marks

@steffentchr
steffentchr / example.php
Created August 24, 2012 12:37 — forked from drewjoh/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("KEY", "[email protected]");
$fh = fopen("/tmp/test.pdf", "rb");
$data = fread($fh, 4096);
$result = $postmark->to("[email protected]")
->subject("Testing attachments")
@steffentchr
steffentchr / github-to-podio.tcl
Last active December 19, 2015 14:09
Podio "integration" for Github, works through a simple web POST hook. (And yes, this is annoyingly ugly in how the payload is written to vars and then a `$message`. If you ever use this, at least generalize a bit -- and cut the lines by half. Should make it more readable.)
ad_page_contract {} {
payload:notnull
}
package require json
set payload [json::json2dict $payload]
set repository [dict get $payload repository]
set repository_name [dict get $repository name]
set repository_url [dict get $repository url]
@steffentchr
steffentchr / README.md
Last active July 5, 2018 15:17
An example of how to verify SAML/XML signatures, execute in Ruby. Adapted from https://github.com/zendesk/samlr/.

It's hard to find a good example of how to verify SAML signatures online. There are plenty magic that "just calls a Java method" -- but few clear step-by-step guide.

This gist covers the signature check of a SAML response in Ruby, and as such it's also an example of how to verify an XML Secure.

The code here is lifted entirely from Morten Primdahls and Zendesks awesome SAMLR library.

@steffentchr
steffentchr / 23video-events.js
Last active October 29, 2020 13:19
A sample script for GlueFrame, illustrating how to implement a generic analytics tag, which listens to events from 23 Video player.
(function(){
var identifiedFrames = [];
// Method to run any reporting
var report = function(Player, event, playing, duration) {
Player.get('currentTime', function(currentTime){
Player.get('duration', function(duration){
console.log(event, playing, currentTime, duration);
});
});
@steffentchr
steffentchr / core.js
Created September 21, 2015 10:25
Player: Add a class to <body> for the current channel
Player.bind('player:video:loaded', function(e,video){
var body = $('body');
$.each(body.attr('class').split(' '), function(i,className){
if(/^album-\d+$/.test(className)) body.removeClass(className);
});
$.each(video.album_id.split(' '), function(i,id){
body.addClass('album-'+id);
});
});
@steffentchr
steffentchr / keybase.md
Created October 6, 2015 08:04
keybase.md

Keybase proof

I hereby claim:

  • I am steffentchr on github.
  • I am steffentchr (https://keybase.io/steffentchr) on keybase.
  • I have a public key whose fingerprint is 3093 044C 5DE6 829D 6D7A 6BC8 648E 6DF9 AFDE AAD2

To claim this, I am signing this object: