Skip to content

Instantly share code, notes, and snippets.

// javascript
var takeSnapshot = function (clientId) {
var videoElem = document.getElementById(clientId);
var canvas = document.getElementById(“chat-paint-canvas”);
var ctx = canvas.getContext(‘2d’);
ctx.drawImage(videoElem, 0, 0, 30, 30);
return canvas.toDataURL();
};
// html
@dagingaa
dagingaa / oauth-client.rb
Created July 9, 2012 13:48
A minimal Sinatra OAuth 2.0 client and resource server.
require 'sinatra'
require 'open-uri'
require 'json'
# This application is the bare minimum to authorize with OAuth 2.0
# using the authorization grant scheme. No error handling included.
# The application is both a client and a resource server.
# Start it by using 'ruby <file>' and navigate to http://localhost:4567
#
# The application also needs the oauth-server written in Java.