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
| 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
| // 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
| // <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
| git checkout <bad-commit> | |
| # ... make your changes ... | |
| git commit --amend -v | |
| git rebase --onto HEAD <bad-commit> <checked-out-branch> |
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
| // object.watch by Eli Grey: https://gist.github.com/eligrey/175649 | |
| if (!Object.prototype.watch) | |
| { | |
| Object.prototype.watch = function (prop, handler) | |
| { | |
| var val = this[prop], | |
| getter = function () | |
| { | |
| return val; | |
| }, |
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
| sudo chsh -s /bin/bash username |
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
| .. = cd .. | |
| pro = cd /projects | |
| ll=ls -Xal --color | |
| ip = ipconfig | grep "IPv4" | |
| build = npm run build | |
| bb = npm run build | |
| n = npm $* |
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
| // Warning: if you want add 300+ files your chrome will probably crash. | |
| var a=document.querySelectorAll('.yt-uix-button');for(var i=0,l=a.length;i<l;i++){a[i].click()}; |