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() { | |
var Crawler,phantom,cheerio; | |
cheerio = require("cheerio"), | |
phantom = require('phantom'); | |
var waitUntil = function(asyncTest) { | |
return new Promise(function(resolve, reject) { | |
function wait() { |
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
{ | |
"document_tone": { | |
"tone_categories": [ | |
{ | |
"tones": [ | |
{ | |
"score": 0.308012, | |
"tone_id": "anger", | |
"tone_name": "Anger" | |
}, |
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
{ | |
"document_tone": { | |
"tone_categories": [ | |
{ | |
"tones": [ | |
{ | |
"score": 0.246262, | |
"tone_id": "anger", | |
"tone_name": "Anger" | |
}, |
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
subset = [ | |
'item1' | |
'item2' | |
'item3' | |
] | |
# uniform distribution of wait times | |
waitTimes = arrayRangeMap(subset.length, -> | |
getRandomArbitrary(0.1, 0.3, 3) * 1000 | |
) | |
Q = PromiseAllP(subset, executionBlock, waitTimes) |
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 twitterRemoveCharLimit() { | |
function hasClass(ele, cls) { | |
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); | |
} | |
function removeClass(ele, cls) { | |
if (hasClass(ele, cls)) { | |
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)'); | |
ele.className = ele.className.replace(reg, ' '); | |
} |
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
let serialise = function(obj) { | |
if (typeof obj != 'object') return obj; | |
let pairs = []; | |
for (let key in obj) { | |
if (null != obj[key]) { | |
pairs.push(encodeURIComponent(key) | |
+ '=' + encodeURIComponent(obj[key])); | |
} | |
} | |
return pairs.join('&'); |
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
TO circle | |
REPEAT 180 [FD 1 RT 2] | |
END | |
TO place | |
PU | |
RT 90 | |
FD 60 | |
LT 90 | |
PD |
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
// inject Wicked-Good-Xpath | |
var script = document.createElement('script'); | |
script.src = "https://github.com/google/wicked-good-xpath/releases/download/1.3.0/wgxpath.install.js"; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
script.onload=function() { | |
console.log("injected") | |
// install wgxpath | |
wgxpath.install() | |
// create expression | |
var expressionString = '//*[@class="word-and-pronunciation"]/h1'; |
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
// wgxpath + jsdom | |
var wgxpath = require('wgxpath'); | |
var jsdom = require('jsdom'); | |
// cheerio + request | |
var cheerio = require('cheerio'); | |
var request = require('request'); | |
var url = 'http://www.merriam-webster.com/word-of-the-day'; | |
var expressionString = '//*[@class="word-and-pronunciation"]/h1'; |
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
import pickle | |
file = open("~/.keras/datasets/imdb_full.pkl",'rb') | |
file = open(".keras/datasets/imdb_full.pkl",'rb') | |
object_file = pickle.load(file) | |
file.close() |