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
<script> | |
var xhttp=new XMLHttpRequest(); | |
xhttp.open("GET","http://localhost:8888/start",false); | |
xhttp.send(); | |
console.log(xhttp.responseText); | |
</script> |
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
Obj = function(){ | |
this.properties = {'foo':'bar'}; | |
} | |
Obj.prototype.returnTrue = function(){ | |
return true; | |
} | |
var objInstance = new Obj(); |
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 flag = false; | |
var page = require('webpage').create(); | |
page.onLoadFinished = function() { | |
flag = !flag; | |
if (flag) { | |
console.log('jump to google'); | |
page.evaluate(function() { | |
window.location.href = 'http://www.google.com/'; |
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
const QUEUE_LENGTH = 1; | |
var numRunningJobs = 0; | |
var numWaitingJobs = 0; | |
var parrallelCallback = function() { | |
numRunningJobs --; | |
if (numRunningJobs === 0 && numWaitingJobs === 0) { | |
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
var _hmt = _hmt || []; | |
$(function () { | |
$.getJSON("/f/user/json_userinfo?_=" + new Date().getTime(), function (response) { | |
var userInfo = response.data; | |
if (userInfo.is_login) { | |
console.log("login") | |
_hmt.push(['_setCustomVar', 1, 'login', 1]); | |
} else { | |
console.log("not_login"); | |
_hmt.push(['_setCustomVar', 1, 'login', 0]); |
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
const TEXT_PREFIX = /<html><head><\/head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/; | |
const TEXT_SUFFIX = /<\/pre><\/body><\/html>/; | |
var page = require('webpage').create(); | |
page.onLoadFinished = function() { | |
var content = page.content; | |
if (TEXT_PREFIX.test(content) && TEXT_SUFFIX.test(content)) { | |
content = content.replace(TEXT_PREFIX, '').replace(TEXT_SUFFIX, ''); | |
}; |
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 page = require('webpage').create(); | |
page.onLoadFinished = function() { | |
var username = page.evaluate(function() { | |
return $('span.user').children('a').html(); | |
}); | |
if (username !== 'cvUg338yQa') { | |
page.evaluate(function(username, password) { | |
$('input[name="user"]:first').attr('value', 'cvUg338yQa'); |
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
(function() { | |
var REQUEST_PATH = '/virtual/im/'; | |
var REQUEST_NAME = ['center', 'left-sum']; | |
var GET_ITEMS = function() { | |
return [ | |
document.getElementById('doyoo_mon_accept'), | |
document.getElementById('ncontent') | |
]; | |
}; |
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
<?php | |
require('simple_html_dom.php'); | |
$html = file_get_html('http://hi.baidu.com/new/bdtongji'); | |
foreach($html->find('article') as $element) { | |
$day = $element->find('.q-day', 0)->plaintext; | |
$monthYear = $element->find('.q-month-year', 0)->plaintext; | |
if (!is_null($day) && !is_null($monthYear)) { |
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
#!/usr/bin/python | |
import re, sys, urllib | |
if __name__ == '__main__': | |
e = len(sys.argv) >= 3 | |
if len(sys.argv) > 1: | |
r = re.compile('([^\x00-\xff])') | |
f = open(sys.argv[1]) | |
s = f.read() | |
try: |