Skip to content

Instantly share code, notes, and snippets.

View rynomad's full-sized avatar

Ryan Bennett rynomad

View GitHub Profile
//Object DetectSubtleCrypto()
//Establish the availability of various crypto.subtle API's necessary for keygen, signing, verification, hashing
function DetectSubtleCrypto(){
var supportedApis = {};
var baselineSupport = (
(crypto && crypto.subtle)
&& (
(location.protocol === "https:" || "chrome-extension:" || "chrome:")
|| (location.hostname === "localhost" || location.hostname === "127.0.0.1")
)
var proc = {}
module.exports = proc;
var msCh = new MessageChannel()
var queue = [];
msCh.port1.onmessage = function(ev) {
var source = ev.source;
if ( ev.data === 'proc-tick') {
if (queue.length > 0) {
var fn = queue.shift();
@rynomad
rynomad / gist:6604213
Created September 18, 2013 03:34
NDN CSTable hack
function getEntryForRegisteredPrefix(name) {
for (var i = 0; i < NDN.CSTable.length; i++) {
console.log(NDN.CSTable[i], name);
var entry = new Name(NDN.CSTable[i].name);
var interestName = new Interest(entry);
if (interestName.matches_name(new Name(name)) == true){
console.log('Match!!!', NDN.CSTable[i], name);
return NDN.CSTable[i];
}
}