This file contains 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'); | |
var request = require('request'); | |
var urls = new Array("http://www.yahoo.com","http://www.bing.com"); | |
for (var i = 0; i < urls.length; i++) { | |
var file = 'log'+[i]+'.txt'; | |
var url = urls[i]; |
This file contains 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'); | |
var request = require('request'); | |
var urls = new Array("http://www.yahoo.com","http://www.bing.com"); | |
function scrape(url,file){ | |
request(url, function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
console.log('request url: '+url); |
This file contains 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
<style> | |
body {text-align: center;} | |
#drag { border: 10px solid black; text-align: center; padding:20px; width: 500px; margin: auto; font-size: 40px; display: inline-block;} | |
#einput {width:400px;} | |
#output {margin:20px;} | |
#filesinput, #directoryinput, #zipinput { | |
visibility: collapse; | |
width: 0px; | |
} | |
#output img{ |
This file contains 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
/* Drag'n drop stuff */ | |
var drag = document.getElementById("drag"); | |
drag.ondragover = function(e) {e.preventDefault()} | |
drag.ondrop = function(e) { | |
e.preventDefault(); | |
var length = e.dataTransfer.items.length; | |
for (var i = 0; i < length; i++) { | |
var entry = e.dataTransfer.items[i].webkitGetAsEntry(); | |
var file = e.dataTransfer.files[i]; |
This file contains 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 find1 = document.getElementById("find1"); | |
var find2 = document.getElementById("find2"); | |
var info = document.getElementById("info"); | |
//use array to determine how it goes into DOM, I think you could use Data Attributes: http://html5doctor.com/html5-custom-data-attributes/ | |
var selector = []; | |
find1.addEventListener("click", function() { | |
This file contains 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
{ | |
"glossary": { | |
"title": "example glossary", | |
"GlossDiv": { | |
"title": "S", | |
"GlossList": { | |
"GlossEntry": { | |
"ID": "SGML", | |
"SortAs": "SGML", | |
"GlossTerm": "Standard Generalized Markup Language", |
This file contains 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
//return an array of objects according to key, value, or key and value matching | |
function getObjects(obj, key, val) { | |
var objects = []; | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) continue; | |
if (typeof obj[i] == 'object') { | |
objects = objects.concat(getObjects(obj[i], key, val)); | |
} else | |
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
if (i == key && obj[i] == val || i == key && val == '') { // |
This file contains 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
//phantomjs | |
var page = require('webpage').create(); | |
var url = 'http://instagram.com/'; | |
page.open(url, function (status) { | |
var js = page.evaluate(function () { | |
return document; | |
}); | |
console.log(JSON.stringify(js)); | |
phantom.exit(); |
This file contains 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
//phantomjs | |
var page = require('webpage').create(); | |
var url = 'http://instagram.com/'; | |
page.open(url, function (status) { | |
var js = page.evaluate(function () { | |
return document; | |
}); | |
console.log(js.all[0].outerHTML); | |
phantom.exit(); |
This file contains 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
<?xml version="1.0" encoding="UTF-8" ?> | |
<rss version="2.0" | |
xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:wp="http://wordpress.org/export/1.2/" | |
> |