This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rawHtml = '<!DOCTYPE HTML><html lang="en"><head><title>LEtss goo</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="en-us"><link rel="icon" type="image/png" href="/favicon.png"><link rel="stylesheet" type="text/css" href="css/style.css"><link rel="stylesheet" type="text/css" href="css/jquery.gritter.css"><link rel="stylesheet" type="text/css" href="css/jScrollPane.css"><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><script type="text/javascript" src="js/lib/jquery.mousewheel.js"></script><script type="text/javascript" src="js/lib/jquery.em.js"></script><script type="text/javascript" src="js/lib/jScrollPane.js"></script><script type="text/javascript" src="js/lib/jquery.autolink.js"></script><script type="text/javascript" src="js/lib/jquery-css-transform.js"></script><script type="text/javascript" src="js/lib/jquery-animate-css-rotate-scale.js"></script><script type="text/javasc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var text = '<!DOCTYPE HTML><html lang="en"><head><title>Woo</title></head><body></body></html>'; | |
var jsdom = require('jsdom').jsdom; | |
var window = jsdom(text).createWindow(); | |
// here's the doctype | |
console.log(window.document.doctype+''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ERR</title> | |
<script type="text/javascript" src="jquery-1.4.2.min.js"></script> | |
<script type="text/javascript" src="pixastic/pixastic.core.js"></script> | |
<script type="text/javascript" src="pixastic/actions/colorhistogram.js"></script> | |
<style type="text/css" media="screen"> | |
#testImage {width:auto;height:auto;} | |
</style> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/course/cs053/bin/python3 | |
import os, time | |
import sys | |
""" | |
reruns the given file whenever it changes. | |
usage: python3 run.py myfile.py | |
""" | |
def stat(f): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/course/cs053/bin/python3 | |
import os, time | |
import sys | |
""" | |
reruns the given file whenever it changes. | |
usage: python3 run.py myfile.py | |
""" | |
def stat(f): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('sys') // update this at some point | |
, ns = require('node-static') | |
, http = require('http') | |
, fileServer = new ns.Server('./public'); | |
http.createServer(function (request, response) { | |
request.addListener('end', function () { | |
fileServer.serve(request, response, function (err, result) { | |
if (err) { // An error as occurred |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scraping Made Easy with jQuery and SelectorGadget | |
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga) | |
// by David Trejo | |
// | |
// Install node.js and npm: | |
// http://joyeur.com/2010/12/10/installing-node-and-npm/ | |
// Then run | |
// npm install jsdom jquery http-agent | |
// node numresults.js | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findBeer(words) { | |
//...code... | |
getResults(word, function(err, result){ | |
// now you can access things! | |
console.log(err, result); | |
}); | |
} | |
function getResults(word, callback) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
, path = './DELETEME.txt' | |
, stream = fs.createWriteStream(path, { flags: 'w+', encoding: 'utf8' }) | |
, data = { "I":0.18181818181818182,"bought":0.18181818181818182 } | |
; | |
function cb(err) { | |
if (err) console.log(err); | |
console.log('cool, all done.'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('underscore')._; | |
var data = {"1":0.000007223714765952328,"2":0.0000039749105916010536,"3":0.0000032965765671970454,"7":0.0000020878318258914622,"8":0.000002736989620496371,"9":0.000003076694134649906,"10":0.0000013715180458375907,"12":0.000001159906569939701,"15":6.457211832654003e-7,"18":6.457211832654003e-7,"19":0.0000026097897823643283,"20":0.0000026097897823643266,"21":9.490144663143008e-7,"23":3.4414810316892216e-7,"24":8.821824616442793e-7,"26":0.0000024947065913923583,"38":0.000004404915773841593,"40":0.0000023785425864586267,"41":0.0000018918312871343038,"42":0.0000014913084470653296,"44":0.0000023665042941778225,"51":9.942056313768864e-7,"57":0.0000010616094029956584,"58":0.0000024056413215874137,"100":4.971028156884432e-7,"230":0.0000015658738694185964,"1998":0.000026218026718821232,"the":0.0007400023061007896,"Honourable":0.00022929140436720472,"Gildas":0.00001957342336773246,"L":0.00001957342336773246,".":0.0006657129490331946,"Molgat":0.00001957342336773246,",":0.0003656978308864 |