-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2419a28
Showing
16 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<body> | ||
<textarea id="textarea" rows=20 cols=50></textarea> | ||
<br> | ||
<input type=button onClick='compute()' value='go'/> | ||
<br> | ||
<div id="result"> | ||
<script> | ||
function findAllIndexes(regex,string){ | ||
var ret = []; | ||
var last = 0; | ||
while(r=regex.exec(string.substring(last))){ | ||
ret.push({string: r.toString(), index: r.index}); | ||
} | ||
return ret; | ||
} | ||
|
||
function getClosest(num,arr){ | ||
for(var n=arr.length-1;arr[n]>num||n>=0;n--); | ||
return arr[n]; | ||
} | ||
|
||
function compute(){ | ||
var result =""; | ||
value = document.getElementById("textarea").value.replace(/\r\f/g,""); | ||
|
||
ss = findAllIndexes(/<\s*script[^>]*>/gi,value); | ||
es = findAllIndexes(/<\/\s*script[^>]*>/gi,value); | ||
//sc = findAllIndexes(/<\!--/g,value); | ||
//ec = findAllIndexes(/-->/g,value); | ||
|
||
for(i=0;i<ss.length-1;i++){ | ||
while(ss[i+1]&&ss[i+1].index<es[i].index)ss.splice(i+1,1); | ||
} | ||
|
||
start = 0; | ||
for(i = 0; i<ss.length;i++){ | ||
if(ss[i].string.search(/\ssrc\s*=\s*/)>-1) | ||
result += "document.write('"+value.substring(start,es[i].index+es[i].string.length).replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/script/g,"scr'+'ipt").replace(/\n/g,"');\ndocument.write('")+"');\n"; | ||
else if(ss[i].string.search(/\stype\s*=\s*['"]?/)>-1&&ss[i].string.search(/\stype\s*=\s*['"]?text\/javascript/)<0) | ||
result += "document.write('"+value.substring(start,es[i].index+es[i].string.length).replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/script/g,"scr'+'ipt").replace(/\n/g,"');\ndocument.write('")+"');\n"; | ||
else | ||
result += "document.write('"+value.substring(start,ss[i].index).replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/\n/g,"');\ndocument.write('")+"');\n"+value.substring(ss[i].index+ss[i].string.length,es[i].index)+"\n"; | ||
start = es[i].index+es[i].string.length; | ||
} | ||
result += "document.write('"+value.substring(start).replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/\n/,"');\ndocument.write('")+"');\n"; | ||
|
||
var ind = []; | ||
|
||
document.getElementById("result").innerHTML = result.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>"); | ||
} | ||
</script> | ||
</body> |
Empty file.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
this is the first creative |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
t's okay! |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var fs = require('fs'); | ||
|
||
function Logger(name){ | ||
this.ws = fs.createWriteStream(name,{flags:'a',encoding:null,mode:0666}); | ||
this.data = []; | ||
} | ||
|
||
Logger.prototype.endDay(newFile){ | ||
this.ws.end(data.join("\n")); | ||
this.ws = fs.createWriteStream(newFile,{flags:'w',encoding:null,mode:0666}); | ||
this.data = []; | ||
} | ||
|
||
Logger.prototype.write(d){ | ||
this.data.push(d); | ||
if(data.length>=1000){ | ||
data = []; | ||
this.ws.write(this.data.join("\n")); | ||
} | ||
} | ||
|
||
module.exports.Logger = Logger; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var net = require('net'); | ||
|
||
|
||
|
||
var socket = net.createConnection(11211); | ||
socket.on('connect',function(){console.log("connected!");}); | ||
|
||
socket.on('data',function(data){console.log(data.toString());}); | ||
socket.write("hello\r\n"); | ||
|
Oops, something went wrong.