Skip to content

Instantly share code, notes, and snippets.

View itissid's full-sized avatar

Sid itissid

  • New York
View GitHub Profile
@itissid
itissid / gist:709246
Created November 21, 2010 22:48
jsdom port
//TO USE JUST save it and FIRE node <filename.js>
//AT THE BOTTOM THERE ARE TWO URL'S. TEST CASE IS FOR URL POINTING TO SUN'S JAVADOC ,A PAGE THAT MAKEE HEAVY //USE OF IFRAMES
// Should process HTML text and dump it on terminal
// Error on terminal with a backtrace
/*
/home/sid/opt/lib/node/.npm/jsdom/0.1.20/package/lib/jsdom/level2/html.js:1400
this._contentDocument = new HTMLDocument();
^
ReferenceError: HTMLDocument is not defined
at Object.contentDocument (/home/sid/opt/lib/node/.npm/jsdom/0.1.20/package/lib/jsdom/level2/html.js:1400:9)
var request = require('request'),
jsdom = require('jsdom'),
net = require('net'),
DocumentSaver = require('./scrobblepage.js'),
filter = require('./documentfilter.js');
exports.handleRequests = function(response, URLlst){
//Crawl a page, gather text, filter it
@itissid
itissid / gist:712976
Created November 24, 2010 02:08
Sample code
for(doc=0 ; doc<this.docs.length; doc++ ){
var self = this;
//Need to scale as too many connections are formed too quickly.. Server will drown...
(function testServer(data, docnum){
if(self.openConn < 300){
var s = new net.Stream();
s.setEncoding('utf8');
s.on('connect', function(){
for(doc=0 ; doc<this.docs.length; doc++ ){
var self = this;
//Need to scale as too many connections are formed too quickly.. Server will drown...\
//Suggested: process all the data through a Queue and an interval...
//The counter implementation is flaky...
(function testServer(data, docnum){
if(self.openConn < 300){
var s = new net.Stream();
for(doc=0 ; doc<this.docs.length; doc++ ){
var self = this;
//Need to scale as too many connections are formed too quickly.. Server will drown...\
//Suggested: process all the data through a Queue and an interval...
//The counter implementation is flaky...
(function testServer(data, docnum){
var s = new net.Stream();
void static closeOnComplete(struct evbuffer *buffer,
const struct evbuffer_cb_info *info, void *arg){
struct total_processed *tp = (total_processed *)arg;
size_t towrite_n = tp->n;
size_t drained = info->n_deleted;
if(drained >= (towrite_n -1)){
//close the socket connection...
cout<<"***Done with draining***"<<endl;
cout<<drained<<" out of "<<towrite_n<<" bytes drained"<<endl;
consumer = module.exports = function() {
this.q = [];
this.pr = [];
var self = this;
this.getQ = function(){
return this.q;
};
this.on('consume', function(){
var arr_t = self.q.pop();
});
namespace PandoraSmuggler
{
partial class PandoraSmuggler
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
var sbAccordian = new Ext.Panel({
title: 'Manage Something',
layout:'accordion',
layoutConfig: {
// layout-specific configs go here
titleCollapse: false,
animate: true
//activeOnTop: true
},
items: [{
/**Tree Panel with search bar...*/
var SBTreePanel = function(){
SBTreePanel.superclass.constructor.call(this, {
id:'sbooktreepanel',
region:'west',
split:true,
width: 280,
minSize: 175,
collapsible: true,
rootVisible:false,