Skip to content

Instantly share code, notes, and snippets.

View grampelberg's full-sized avatar

Thomas Rampelberg grampelberg

View GitHub Profile
from twisted.enterprise import adbapi
from twisted.web import server, resource
from twisted.internet import reactor
import oauth.oauth as oauth
REQUEST_TOKEN_URL = '/request_token'
ACCESS_TOKEN_URL = '/access_token'
AUTHORIZATION_URL = '/authorize'
CALLBACK_URL = '/request_token_ready'
<div id="donate-button">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<button type="submit" id="donate-tab" style="background-color: #4D7587; border: 1px #4D7587; display: block; height: 72px; left: 0px; margin: -45px 0px 0px; padding: 0px; position: fixed; text-indent: -9000px; top: 45%; width: 25px; z-index: 100001; background-image: url(http://saunter.org/imgs/donate_left.png);"></button>
<INPUT type="hidden" name="cmd" value="_s-xclick">
<INPUT type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCRpfRF6XMAXMREFkqlf7ESYJSoWXkZR6Sq/aamttWQV1N40ZdZq7IZuzHoOcbPDRDgy3vKqizZVso+fLE2uUX7FQ5f2kGh1CB8ToFBDFkp70W+XHwtaA3t/121qaOhx81RiU5uhmdzJotuxbjHiJhqgTYAW06de2lXcIEUj/r+4DELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUB
var http = require('http');
var google = http.createClient(80, 'www.google.com');
var request = google.request('GET', '/',
{'host': 'www.google.com'});
request.end();
request.on('response', function (response) {
console.log('STATUS: ' + response.statusCode);
console.log('HEADERS: ' + JSON.stringify(response.headers));
response.setEncoding('utf8');
response.on('data', function (chunk) {
{ "name": "scrape-ted",
"version": "0.0.1",
"dependencies": { "request": "" },
"bin": { "scrape-ted": "./node.client.js" },
"directories": { "lib": "lib" },
"engines": ["node >= 0.1.90"]
}
npm info it worked if it ends with ok
npm info version 0.1.27-1
npm info link /home/trampelb/code/apps/ted/scraper
npm ok
--------------------------------------------------
node.js:275
throw new Error("Cannot find module '" + request + "'");
{ "name": "scrape-ted",
"version": "0.0.1",
"dependencies": { "request": "*",
"jsdom": "*",
"htmlparser": "*" },
"bin": { "scrape-ted": "./node.client.js" },
"directories": { "lib": "lib" },
"engines": ["node >= 0.1.90"]
}
function(doc, req) {
var type = null;
if ('type' in req.query)
type = req.query.type;
if (type && doc.status == type) {
return true;
} else if (!type && !('status' in doc)) {
return true;
}
var couchdb = require('couchdb');
var request = require('request');
var sys = require("sys");
var jsdom = require("jsdom");
var _ = require('underscore')._;
var mustache = require('mustache');
var window = jsdom.jsdom().createWindow();
var $ = null;
var client = couchdb.createClient(5984, '127.0.0.1', 'username',
var tags = {
{ name: 'jquery' },
{ name: 'jquery.json',
requires: ['jquery'] },
{ name: 'chromeframe',
path: 'https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/' }
};
var loader = JSLoad(tags, '/static/js');
var Sinew = {
View: Backbone.View.extend({
initialize: function() { },
render: function() { }
})
};