I hereby claim:
- I am krofdrakula on github.
- I am krofdrakula (https://keybase.io/krofdrakula) on keybase.
- I have a public key whose fingerprint is A5B2 D08D 4333 E167 DB37 A7C0 6444 7954 106D 1D39
To claim this, I am signing this object:
| DBBuild.php merge=merge-and-verify |
| // shorter vars for brevity | |
| var a = image.naturalWidth, | |
| b = image.naturalHeight, | |
| c = maxImageWidth, | |
| d = maxImageHeight, | |
| r1 = a / b, // image aspect ratio | |
| r2 = c / d; // container aspect ratio | |
| // determine which dimension is the limiting factor | |
| // according to the aspect ratio comparison and |
| // A very light-weight templating function | |
| // Use <% ... %> to embed code, <%= ... %> to output expressions. | |
| // | |
| // Caveat: because the parser makes no attempts at interpreting | |
| // any `<%` and `%>` inside code blocks, so if you need | |
| // metatemplating, you need to escape those sequences | |
| // just like '<scr'+'ipt>' in script tags. | |
| // | |
| // See examples of usage below. | |
| function template(str, params) { |
| function ObjectPool(Type) { | |
| this.Type = Type; | |
| this.available = []; | |
| this.active = []; | |
| } | |
| ObjectPool.prototype.create = function() { | |
| var args = [].slice.apply(arguments), self = this, inst, ret; | |
| if (this.available.length == 0) { | |
| var Temp = function() {}; |
| (function(global) { | |
| function Dither(container, width, height) { | |
| this.container = container; | |
| this.width = width; | |
| this.height = height; | |
| this.canvas = null; | |
| this.image = null; | |
| this.draw = this.draw.bind(this); |
| (function(global) { | |
| function extend(obj) { | |
| for (var i = 1; i < arguments.length; i++) { | |
| var source = arguments[i]; | |
| for (var name in source) if (source.hasOwnProperty(name)) | |
| obj[name] = source[name]; | |
| } | |
| return obj; | |
| } |
I hereby claim:
To claim this, I am signing this object:
| // Use `<% ... %>` to execute blocks of JavaScript, `<%= ... %>` to write | |
| // out the result of the embedded expression. | |
| function tmpl(str, params) { | |
| if (!str) return ''; | |
| function generateOutput(str) { | |
| return " p.push('" + str.replace(/'/g, "\\'").split(/\r?\n/g).join("\\n');\n p.push('") + "');\n"; | |
| } | |
| var fn; |
| scrolling: yes | |
| height: 800 |
| class Vec2d { | |
| constructor(x, y) { this.reset(x, y); } | |
| get mag() { return Math.sqrt(this.dot(this)); } | |
| clone() { return new Vec2d(this.x, this.y); } | |
| reset(x, y) { this.x = x; this.y = y; return this; } | |
| neg() { return this.scale(-1); } | |
| norm() { | |
| let m = this.mag; | |
| if (m > 0) return this.scale(1 / m); | |
| return this; |