A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$ if your browser aliases it:
~ 108 byte version
| /** | |
| * Calculates the total size of all the items in local storage. | |
| * @returns {Number} The total size of all the items in local storage in bytes. | |
| */ | |
| function calculateLocalStorageSize() { | |
| return new Blob(Object.keys(localStorage).map(k => k + localStorage[k])).size; | |
| } |
| /** | |
| * Calculates the ideal ramp length and height for a car jump based on the preference for a higher or longer jump. | |
| * | |
| * @param {'higher' | 'longer'} preference - The preference for the jump, either "higher" or "longer". | |
| * @returns {{length: string, height: string}} - An object containing the scaled length and height of the ramp in meters. | |
| * @throws {Error} - Throws an error if the preference is not "higher" or "longer". | |
| */ | |
| function calculateRcRamp(preference) { | |
| const g = 9.81; | |
| const scale = 1; |
| function randomIntFromInterval(min, max) { // min and max included | |
| return Math.floor(Math.random() * (max - min + 1) + min); | |
| } |
| export default (itemName, defaultValue, postFn = (str) => str) => { | |
| const item = localStorage.getItem(itemName); | |
| if (item) { | |
| return postFn(item); | |
| } | |
| return defaultValue; | |
| }; |
| <?php | |
| function dirToArray($dir) { | |
| $ignoredPath = array( | |
| ".", | |
| "..", | |
| ".htaccess" | |
| ); | |
| $result = array(); |
| export default (cardNumber) => { | |
| // MasterCard | |
| if (/^5[1-5]/.test(cardNumber)) { | |
| return 'mastercard'; | |
| } | |
| // Visa | |
| if (/^4/.test(cardNumber)) { | |
| return 'visa'; | |
| } |
| const contentHashGenerator = (str = '') => { | |
| let hash = 0; | |
| let i; | |
| let chr; | |
| if (str.length === 0) return hash; | |
| for (i = 0; i < str.length; i++) { | |
| chr = str.charCodeAt(i); | |
| // eslint-disable-next-line | |
| hash = ((hash << 5) - hash) + chr; | |
| // eslint-disable-next-line |
| [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+ |
| var getQueryParam = function getQueryParam (param) { | |
| var queries = window.location.search, regex, resRegex, results, response; | |
| param = encodeURIComponent(param); | |
| regex = new RegExp('[\\?&]' + param + '=([^&#]*)', 'g'); | |
| resRegex = new RegExp('(.*)=([^&#]*)'); | |
| results = queries.match(regex); | |
| if (!results) { | |
| return ''; | |
| } |