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
/* How to use | |
//Create a node: | |
var node=new Tree(5); | |
node.data==5//true | |
//add Children, accepts a value | |
node.addChild(10); | |
//or a tree itself | |
node.addChild(new Tree(6)); |
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 getDups(){ | |
var outstring=""; | |
for(var i=0;i<dups.length;i++){ | |
console.log(g[dups[i]].post) | |
outstring+=Object.keys(g[dups[i]].dups).concat(g[dups[i]].post).map(function(a){return ">>"+a}).join('\n')+'\n\n'; | |
} | |
return outstring | |
} |
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
http://jsfiddle.net/z9b2m/44/show/ ?!?!?!?? | |
http://jsfiddle.net/ztfv652d/3/ | |
:D | |
Other jsfiddles: | |
http://jsfiddle.net/T7Srr/11/ | |
http://jsfiddle.net/gvKtN/6/show | |
http://jsfiddle.net/HbhXY/6/show/ | |
http://jsfiddle.net/upnMK/4/show/ |
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 objectLoop(obj, callback) { | |
if (!obj) return null; | |
var it, key, l, currobj = { | |
obj: obj, | |
keys: Object.keys(obj), | |
index: 0 | |
}, | |
nest = []; | |
mai: while (currobj) { | |
sec: while (currobj.index < currobj.keys.length) { |
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 getDrawURL(){ | |
var img=document.createElement('img'),canvas=document.createElement('canvas'),context=canvas.getContext('2d'); | |
img.src='http://fc05.deviantart.net/fs70/i/2013/357/c/8/my_teenage_pony_by_kilala97-d6z4jke.jpg'; | |
canvas.height=img.height; | |
canvas.width=img.width; | |
context.drawImage(img,0,0) | |
return canvas.toDataURL('image/png'); | |
} |
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 wakeUpMotherfucker(){ | |
open("https://www.youtube.com/watch?v=2GaVRdEJGmM"); | |
} | |
var wakeUpTime=new Date; | |
wakeUpTime.setHours(5); | |
wakeUpTime.setMinutes(25); | |
setTimeout(wakeUpMotherfucker,wakeUpTime-Date.now()); |
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 agrupateBy3CharacterGroups(words){ | |
var wordsAnswer=[],wordGroups=[],word; | |
for(var i=0;i<words.length;i++){ | |
word=Word3Chars(words[i]); | |
for(var _i=0;;_i++){ | |
if(!wordGroups[_i]){wordGroups[_i]=word;wordsAnswer[_i]=words[i];break}else{ | |
if(wordsAnswer[_i].length<120&&!hasSharedChildren(wordGroups[_i],word)){ | |
wordsAnswer[_i]+=" "+words[i];wordGroups[_i]=wordGroups[_i].concat(word);break | |
} | |
} |
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
document.getElementsByTagName('textarea')[0].value.replace(/SHAPE=[^:]+:0/g,function(a){return a.substr(0,a.length-1)+(Math.floor(Math.random()*0xFFFFFF))}).replace(/\n/g,"\r\n") |
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
//Helper functions | |
//Tree Implimentation from https://gist.github.com/RainbowDangerDash/e006151f60003487e208 | |
function Tree(data) { | |
this.data = data; | |
this.children = []; | |
this.parent = null; | |
this.length = 0; | |
this.level=0//useful for debugging how deep a node is | |
} | |
Tree.fromJSON = function(jsonTree) { |
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
m=0:32 | |
x=0:48 | |
function x= pot(x) | |
x=(-x/4)+8; | |
end | |
function x=ric(x) | |
x=(-x/2)+24; | |
end | |
plot(m,pot(m),x,ric(x)); |