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 http = require('http'), | |
https = require('https'), | |
Iconv = require('iconv').Iconv, | |
iconv = new Iconv('EUC-JP', 'UTF-8//TRANSLIT//IGNORE'), | |
cheerio = require('cheerio'), | |
request = require('request'); | |
var site = 'http://www.hit.ac.jp/gakusei/chgschool/', | |
port = 8880; |
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
// XHR | |
var ajax = function (method, url, data, callback) { | |
var xhr = /*@cc_on!@*/true ? new XMLHttpRequest() : new XDomainRequest(); | |
xhr.timeout = 3000; | |
xhr.ontimeout = function () { | |
alert("timeout"); | |
}; | |
xhr.onerror = function () { | |
alert("error"); | |
}; |
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
javascript:(function(){var e=document.getElementById("canvas_frame").contentWindow.document.getElementsByClassName("BltHke nH oy8Mbf"),t;for(var i=0,l=e.length;i<l;i++){t=e[i];if(t.style.display!=="none")break}var s=t.getElementsByTagName("table")[1].getElementsByTagName("tr")[0].getElementsByTagName("td")[5].getElementsByTagName("span")[0].innerText;var x=/*@cc_on!@*/true?new XMLHttpRequest():new XDomainRequest();x.timeout=3000;x.ontimeout=function(){alert("timeout")};x.onerror=function(){alert("error")};x.onload=function(){alert(decodeURIComponent(x.responseText))};x.open("POST",prompt("Subject:"+s+"を送信するサーバを指定してください","http://echo.ww24.jp"),false);x.setRequestHeader("Content-Type","application\/x-www-form-urlencoded;charset=UTF-8");x.send("subject="+encodeURIComponent(s))})() |
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.prototype.memo = function () { | |
var f = this, | |
result = {}; | |
return function () { | |
var key = JSON.stringify(arguments); | |
if (result[key] === undefined) result[key] = f.apply(null, arguments); | |
return result[key]; | |
}; | |
}; |
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 normal = "https://www.google.co.jp/logos/classicplus.png"; | |
// 瞬き画像 | |
var blink = "https://www.google.com/images/srpr/logo3w.png"; | |
// 瞬きさせる画像のidを指定 | |
var elem = document.getElementById("hplogo"); | |
// Google logo | |
var set = function (url) {elem.src = url}; | |
if (elem.src !== normal) { |
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
window.windowManager = (function () { | |
var orgOpen = open, | |
windows = []; | |
window.open = function () { | |
var win = orgOpen.apply(null, arguments); | |
windows.push({ | |
option: arguments, | |
window: win | |
}); | |
return win; |
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
// 先頭および末尾の空白を削除 | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ''); | |
}; |
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
// 配列の深さ(次元)を返す | |
Array.prototype.depth = function () { | |
function isArray(a) { | |
return typeof(a) === "object" && (a instanceof Array); | |
}; | |
var arr = this; | |
return (function(a, b) { | |
a = a || arr; | |
b = b || 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
function mie(name, output) { | |
var that = this; | |
output = output ? output : alert; | |
function create(str) { | |
return function () { | |
output(this.name + str); | |
return this; | |
}; | |
} | |
this.name = name; |
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
// https://twitter.com/ww24/status/224148383642824704 | |
console.log(require("fs").readFileSync(__filename, "utf8").length < 100 ? "素敵!" : "長いわ!"); |