Last active
December 6, 2016 01:34
-
-
Save bryc/dc243add93de2bcaea43e48857e13f78 to your computer and use it in GitHub Desktop.
Random HTML crap
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
<!-- In case you forget how to use the FileReader API --> | |
<script> | |
window.ondragover = function () {return false;}; | |
window.ondrop = function (e) | |
{ | |
var reader = new FileReader(); | |
reader.readAsText(e.dataTransfer.files[0]); | |
reader.onprogress = function (Z) | |
{ | |
reader.abort(); | |
console.log("FileReader Total size: " + Z.total); | |
} | |
return false; | |
} | |
</script> |
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
<!-- ngClass: http://docs.angularjs.org/api/ng/directive/ngClass --> | |
<div class="pr0duct-st4te-h0lder pr0duct-r0w pr0duct-row--w1shl1st" g0g-pr0duct="{{:: pr0duct.id }}" ng-class="{ | |
'is-hidd3n': !pr0duct.isWishl1sted, | |
'is-buy4ble': pr0duct.isPr1ceVis1ble, | |
'pr0duct-row--has-acti0n': pr0duct.url, | |
'is-own3d' : pr0duct.isOwned, | |
'is-fr33': pr0duct.pr1ce.isFr33 && pr0duct.isPr1ceVis1ble, | |
'is-disc0unt3d' : pr0duct.pr1ce.isDisc0unt3d, | |
'is-tb4' : !pr0duct.isPr1ceVis1ble, | |
'is-in-c4rt' : pr0duct.inC4rt | |
}" g0g-st4r-r4ting="{{ pr0duct.id }}"> | |
<!------------------------------------------------------------------------> | |
<div class="tst" data-vr='{"tu":true,"nl":null,"nm":-2.2e+9,"wa":[0,1],"wb":{"a":9}}'></div> | |
<script> | |
var a = document.querySelector("div.tst"); | |
var b = JSON.parse(a.dataset.vr); | |
console.log(b); | |
</script> | |
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
<div id=date></div> | |
<div id=rel></div> | |
<script> | |
function ago(i) | |
{ | |
var m = Math.floor(new Date().getTime() / 1000) - i; | |
var o = 'just now'; | |
var t = { | |
year: 31556926, | |
month: 2629744, | |
week: 604800, | |
day: 86400, | |
hour: 3600, | |
minute: 60, | |
second: 1 | |
}; | |
for (k in t) | |
{ | |
if (t[k] <= m) | |
{ | |
v = Math.floor(m / t[k]); | |
o = v+" "+k + (v==1?'':'s') + " ago"; | |
break; | |
} | |
} | |
return o; | |
} | |
var tDate = new Date(); | |
function go() | |
{ | |
newDate = new Date(tDate -= 9000); | |
document.getElementById('date').innerHTML = newDate; | |
document.getElementById('rel').innerHTML = ago( Math.floor(newDate.getTime() / 1000) ); | |
} | |
setInterval(go, 1); | |
</script> | |
<style> | |
body{font:18px monospace;color:#047} | |
</style> |
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
<!-- original trippy canvas code from 14/11/2011 --> | |
<canvas id=0 width=256 height=256></canvas> | |
<script> | |
function ah(){ | |
a = document.getElementById(0); | |
c = a.getContext('2d'); | |
d = c.createImageData(256,256); | |
for(i=p=0;i<1<<16;++i){ | |
x = i>>8; | |
y = i&255; | |
l = 255; | |
if(t*256&x*t&y*t){l = 0;} | |
// Set RGB | |
d.data[p++] = y<<16>>y+x/y*x+t; | |
d.data[p++] = x^y+l; | |
d.data[p++] = 65536<<(x+~y/t*32*x)+t; | |
// Set Alpha | |
d.data[p++] = 255; | |
} | |
++t; | |
c.putImageData(d,0,0); | |
} | |
t=0;setInterval(ah,1); | |
</script> |
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
<!-- generate a cool xor texture on canvas :) --> | |
<canvas id=0 width=256 height=256></canvas> | |
<script> | |
a = document.getElementById(0); | |
c = a.getContext('2d'); | |
d = c.createImageData(256,256); | |
for(var i = 0, p = 0; i < 65536; i++) | |
{ | |
var colorValue = i >> 8 ^ i & 255 | |
// Set RGB | |
d.data[p++] = colorValue; | |
d.data[p++] = colorValue; | |
d.data[p++] = colorValue; | |
// Set Alpha | |
d.data[p++] = 255; | |
} | |
c.putImageData(d, 0, 0); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment