Skip to content

Instantly share code, notes, and snippets.

View EtherDream's full-sized avatar
👓
🎃

EtherDream EtherDream

👓
🎃
View GitHub Profile
@EtherDream
EtherDream / prime.html
Created October 14, 2017 12:50
2 to N primes in Jekyll/Liquid
<table border="1">
<tr>
<td width="100">id</td>
<td width="100">num</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
{%- assign MAX = 10000 -%}
var URL = 'http://gd1.alicdn.com/imgextra/i1/394695430/TB2d4w3cXXXXXc4XXXXXXXXXXXX_!!394695430.jpg';
var img = new Image();
img.onload = function() {
var c = document.createElement('canvas');
var w = c.width = img.width;
var h = c.height = img.height;
ctx = c.getContext('2d');
ctx.drawImage(img, 0, 0);
var data = ctx.getImageData(0, 0, w, h);
@EtherDream
EtherDream / event_timestamp.js
Last active August 24, 2017 07:39
e.timeStamp vs Date.now()
var t1, t2;
function sleep(ms) {
var s = Date.now();
while (Date.now() - s < ms);
}
document.addEventListener('mousemove', function(e) {
if (!t1) {
t1 = Date.now();