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
| // <canvas id="main"></canvas> | |
| function init() { | |
| // The two dimensional map array as it sounds is basically your world and what will be drawn. | |
| // Each number can represet a different graphic or possible enviroment interaction. | |
| // In this tutorial case we only have two possible tiles, zero which is blank and one which is filled. | |
| var map = [ | |
| [1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1], | |
| [1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
| [1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], |
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
| // Example for gmail accounts only >> rot13(tznvy.pbz) | |
| function getEmail(u) { | |
| var c = ':otliam'.split('').reverse().join(''); | |
| var a = String.fromCharCode('0'+8*8); | |
| var h = 'tznvy.pbz'.replace(/[a-zA-Z]/g,function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}); | |
| return c+u+a+h; | |
| } |
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
| let object = {}; | |
| object = new Proxy(object, { | |
| set: (o, prop, value) => { | |
| console.warn(`${prop} is set to ${value}`); | |
| o[prop] = value; | |
| }, | |
| get: (o, prop) => { | |
| console.warn(`${prop} is read`); | |
| return o[prop]; |
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
| function getRemoteFilesize($url, $formatSize = true, $useHead = true) { | |
| if (false !== $useHead) { | |
| stream_context_set_default(array('http' => array('method' => 'HEAD'))); | |
| } | |
| $head = array_change_key_case(get_headers($url, 1)); | |
| // content-length of download (in bytes), read from Content-Length: field | |
| $clen = isset($head['content-length']) ? $head['content-length'] : 0; | |
| // cannot retrieve file size, return "-1" |
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
| (function (root) { | |
| var canvas = document.createElement('canvas'); | |
| var context = canvas.getContext && canvas.getContext('2d'); | |
| var DEFAULT_RGB = { r: 0, g: 0, b: 0 }; | |
| function extractRGB(imageData) { | |
| var len = imageData.data.length; | |
| var rgb = { r: 0, g: 0, b: 0 }; | |
| var blockSize = 5; // Check every 5 pixels | |
| var i = -4; |
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
| function invokeOnce($element, eventType, handler, useCapture = false) { | |
| var args = arguments; | |
| $element.addEventListener(eventType, function selfRemoving(event) { | |
| event.target.removeEventListener(event.type, selfRemoving, useCapture); | |
| return handler.apply(handler, args); | |
| }); | |
| } |
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
| runas /profile /user:Administrator /savecred "notepad C:\Windows\System32\drivers\etc\hosts" |
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
| /** | |
| * A collection of helper prototype for everyday DOM traversal, manipulation, | |
| * and event binding. Sort of a minimalist jQuery, mainly for demonstration | |
| * purposes. MIT @ m3g4p0p | |
| */ | |
| window.$ = (function (undefined) { | |
| /** | |
| * Duration constants | |
| * @type {Object} |
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
| @mixin element($e) { | |
| &__#{$e} { @content; } | |
| } | |
| @mixin modifier($e) { | |
| &--#{$e} { @content; } | |
| } | |
| .grid { | |
| $gutter: 30px; |