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
| <?php | |
| function factorial($num) { | |
| return eval('return '.implode(range(1, $num), '*').';'); | |
| } | |
| // more readable form | |
| function factorial2($num) { | |
| $operation = implode(range(1, $num), '*'); | |
| return eval("return $operation;"); | |
| } |
| // Brightness math based on: | |
| // http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx | |
| $red-magic-number: 241; | |
| $green-magic-number: 691; | |
| $blue-magic-number: 68; | |
| $brightness-divisor: $red-magic-number + $green-magic-number + $blue-magic-number; | |
| @function brightness($color) { | |
| // Extract color components |
| beforeEach(function() { | |
| this.addMatchers({ | |
| toBeInstanceOf: function(expectedInstance) { | |
| var actual = this.actual; | |
| var notText = this.isNot ? " not" : ""; | |
| this.message = function() { | |
| return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name; | |
| }; | |
| return actual instanceof expectedInstance; | |
| } |