Skip to content

Instantly share code, notes, and snippets.

@aih
aih / parseAndModifyHtml.js
Created May 8, 2011 17:27 — forked from clarkdave/parseAndModifyHtml.js
Using node.js to parse HTML with jsdom and modify it with jQuery
/**
* npm install jsdom
* npm install jquery
*/
var html = "<!doctype html><html><body><h1>Hello world!</h1></body></html>";
/* parse the html and create a dom window */
var window = require('jsdom').jsdom(html, null, {
// standard options: disable loading other assets
@domenic
domenic / oauth2-restify.js
Created June 2, 2012 06:25
OAuth2 with Restify
"use strict";
var restify = require("restify");
var users = require("./users");
// The users module will have a getAuthorizationFromAccessTokenAsync promise-returning export. (Convert to callbacks if you wish).
// It rejects in cause of not authorized, or fulfills with a { scope, customerId } object if the user is authorized.
// The scope property indicates which scopes the user corresponding to a given access token has.
module.exports = function authPlugin(serverRequest, serverResponse, next) {