Skip to content

Instantly share code, notes, and snippets.

View seanmonstar's full-sized avatar

Sean McArthur seanmonstar

View GitHub Profile
const jwcrypto = require('jwcrypto');
require('jwcrypto/lib/algs/ds');
require('jwcrypto/lib/algs/rs');
exports.sign = function sign(options, callback) {
var pubKey = jwcrypto.loadPublicKey(options.pubkey);
var privKey = jwcrypto.loadSecretKey(options.privkey);
var expiration = new Date();
<script src="https://login.persona.org/include.js"></script>
var http = require('http'),
fs = require('fs'),
path = require('path');
http.createServer(function(req, res) {
console.log('======================');
console.log(req.url);
const winston = require('winston');
var logger = new (winston.Logger)({
// transports and whatever loggy stuffs
});
logger.extend(console);
var log = console.log;
console.log = function hijacked_log(level) {
@seanmonstar
seanmonstar / experimental.js
Last active December 17, 2015 05:49
navigator.id.experimental.login()
/*global setTimeout:true, navigator:true*/
/*
* navigator.id.experimental.login(options)
* - takes same options as navigator.id.request()
* - returns a Promise
* : navigator.id.experimental.login({ siteName: 'Foo"})
* .then(verifyAssertion, onCancel);
*
* navigator.id.experimental.automatic([function])
* - takes an optional callback function
@seanmonstar
seanmonstar / gist:5288105
Created April 1, 2013 21:58
Hashtags as Tag Mentions in Tent v0.3

Hashtags as Tag Mentions

Take this example post with hashtags:

Tent v0.3 is going to totally change the game when all is said and done! #tentdev

What if my client parsed this content before creating the post, and pulled out the hashtag, using this process:

  • Find #hashtags
  • For each hashtag, check to see if a tag (ex: tentdev) post exists, creating if it doesn't.
@seanmonstar
seanmonstar / gist:5286698
Last active December 15, 2015 16:09
Proposal for Tent-RSS bi-directional bridge.

Tent <-> RSS Bridge

Needs a name (smoke-signals?)

This is an open source, hosted, bi-directional bridge of Tent and RSS. It would be hosted somewhere, and installed as an app against your tent server.

Using Python, because it doesn't make us claw our eyes out. Likely with the Flask framework.

Register as an app

function module(window) {
console.log('normal window', window);
console.log('a closure', (function() { return this; })());
console.log('new Func', (new Function('', 'return window'))());
}
module(); //this makes window undefined...sorta...
@seanmonstar
seanmonstar / closure-gotcha.py
Created December 9, 2011 22:06
A gotcha in Python's closures
def something_awesome():
awesome = 1
def increase_awesomeness():
awesome += 1
increase_awesomeness()
return awesome
@seanmonstar
seanmonstar / dont-self-or-that.js
Created October 29, 2011 00:03
If you use `var self = this`, die.
var Example = new Class({
initialize: function() {
// i now hate you if you do this in my codez
var self = this; // or that.
// 10 or 20 lines down, in another closure, I have to read up to
// make sure `self` is set the `this` that I want
// instead, this is they way to go
var example = this;