Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mape on github.
  • I am mape (https://keybase.io/mape) on keybase.
  • I have a public key whose fingerprint is 3E51 97BE 3A21 68F8 6761 5F3F 6F06 2EAE E658 A9ED

To claim this, I am signing this object:

.
|-css
|-img
|-js
|-lib
|---markdown-js
|-----lib
|-----test
|-------features
|---------blockquotes
@mape
mape / NodeQ1.js
Created May 5, 2010 09:26 — forked from bryanwb/NodeQ1
var sys = require('sys'),
spawn = require('child_process').spawn,
ls = spawn('ls', ['-lh', '/usr']);
ls.stdout.addListener('data', function (data) {
sys.print('stdout: ' + data);
});
ls.stderr.addListener('data', function (data) {
sys.print('stderr: ' + data);
var sys = require('sys'),
dom = require(__dirname + '/../../lib/level1/core').dom.level1.core,
fs = require('fs'),
http = require('http');
var window = global.window = require(__dirname + '/../../lib/browser').windowAugmentation(dom);
var document = global.document = global.window.document;
var location = global.location = global.window.location;
var navigator = global.navigator = {
userAgent: 'node-js'
$('.hasHint').live('focus', function (event)
{
if (!$(this).data('origin-text'))
{
$(this).data('origin-text', $(this).val());
}
if ($(this).data('origin-text') == $(this).val());
{
$(this).val('');
// package.js sprint help
// Example output (for a single entry):
/*
{
"name":"Wrench-JS"
,"description":"Useful Node.js operations (recursive directory operations, etc)"
,"url":"http://github.com/ryanmcgrath/wrench-js/"
,"issues":"http://github.com/ryanmcgrath/wrench-js/issues/"
,"mail":"ryan@venodesigns.net"
,"handle":"ryanmcgrath"
var sys = require('sys'),
fs = require('fs');
var libxml = require('libxmljs');
fs.readFile('products.xml', function (err, data) {
var parser = new libxml.SaxParser(function(cb)
{
cb.onStartDocument(function()
{
curl --silent -L "http://www.systembolaget.se/SokDrycker/Produkt?VaruNr=121303" | tidy -indent -quiet --output-xml yes
outputs source
curl --silent -L "http://www.systembolaget.se/SokDrycker/VarFinnsVaranExternt.htm?ArtikelNr=121303" | tidy -indent -quiet --output-xml yes
outputs (sample):
line 211 column 40388 - Warning: <tr> proprietary attribute "height"
line 211 column 40712 - Warning: <tr> proprietary attribute "height"
import urllib2
import sys
from BeautifulSoup import BeautifulSoup
print sys.argv[1]
page = urllib2.urlopen(sys.argv[1])
print page
soup = BeautifulSoup(page)
print soup.prettify()
var sys = require('sys');
var OAuth = require('oauth').OAuth;
var oauthToken = 'IcanHazToken';
var oauthSecret = 'ScoobyDoo';
var oa = new OAuth('http://twitter.com/oauth/request_token', 'http://twitter.com/oauth/access_token', '************', '******************', '1.0', 'HMAC-SHA1');
var url = 'http://api.twitter.com/1/users/show.json?screen_name=mape';
oa.getProtectedResource(url, 'GET', oauthToken, oauthSecret, function (error, data)