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
| //select text inside element | |
| function selectText(e){ | |
| var t,n,o=document,a=window,c=o.body,l="unbdefined"; | |
| typeof a.getSelection!=l&&typeof o.createRange!=l?(n=o.createRange(),n.selectNodeContents(e),t=a.getSelection(),t.removeAllRanges(),t.addRange(n)) : typeof o.selection!=l&&typeof c.createTextRange!=l&&(n=c.createTextRange(),n.moveToElementText(e),n.select()) | |
| } |
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 toggle(a){ | |
| a.style.display==="none"?a.style.display="block":a.style.display="none" | |
| } |
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
| var getAbsoluteUrl=function(){ | |
| var a;return function(b){return a||(a=document.createElement("a")),a.href=b,a.href} | |
| }(); | |
| // usage | |
| getAbsoluteUrl('/di3'); // https://gist.github.com/di3 |
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
| var e = document.createEvent("Events"); | |
| e.initEvent("resize", true, true); | |
| window.dispatchEvent(e); |
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
| php_flag display_startup_errors on | |
| php_flag display_errors on | |
| php_value error_reporting -1 | |
| php_value upload_max_filesize 20M | |
| php_value post_max_size 21M | |
| Action application/x-httpd-php70 /cgi-sys/php70-fcgi-starter.fcgi | |
| AddType application/x-httpd-php70 .php .php70 |
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
| replace javascript object with json | |
| :%s/\([A-z0-9]*\):/"\1":/g |
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
| export default { | |
| WebkitTouchCallout: "none", | |
| MozUserSelect: "none", | |
| WebkitUserSelect: "none", | |
| KhtmlUserSelect: "none", | |
| msUserSelect: "none", | |
| OUserSelect: "none", | |
| userSelect: "none" | |
| } |
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
| //Hamming weight | |
| export const getBitCount32 = (n) => { | |
| n = n - ((n >> 1) & 0x55555555); | |
| n = (n & 0x33333333) + ((n >> 2) & 0x33333333); | |
| return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; | |
| } | |
| export const getBitCount = (n) => { | |
| let str = n.toString(2), count = 0; | |
| for (let i = str.length - 1; i >= 0; i--) { |
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
| export const shuffle = (array) => { | |
| for (let i = array.length - 1; i > 0; i--) { | |
| let rand = Math.floor(Math.random() * (i + 1)); | |
| [array[i], array[rand]] = [array[rand], array[i]] | |
| } | |
| } | |
| export const filter = (arr, cb) => { | |
| var r = []; | |
| for (let i = 0, c = arr.length; i < c; i++) { |
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
| <?php | |
| /* | |
| .env | |
| APP_ENV=local | |
| .local.env | |
| APP_DEBUG=true | |
| .production.env | |
| APP_DEBUG=false | |
| */ |
OlderNewer