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
| /** | |
| * Fancy ID generator that creates 20-character string identifiers with the following properties: | |
| * | |
| * 1. They're based on timestamp so that they sort *after* any existing ids. | |
| * 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
| * 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
| * 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
| * latter ones will sort after the former ones. We do this by using the previous random bits | |
| * but "incrementing" them by 1 (only in the case of a timestamp collision). | |
| */ |
| <VirtualHost *:80> | |
| ServerName myserver.com | |
| ServerAlias www.myserver.com | |
| ProxyRequests off | |
| <Proxy *> | |
| Order deny,allow | |
| Allow from all | |
| </Proxy> |
| var obj = {b: 3, c: 2, a: 1}; | |
| _.sortKeysBy(obj); | |
| // {a: 1, b: 3, c: 2} | |
| _.sortKeysBy(obj, function (value, key) { | |
| return value; | |
| }); | |
| // {a: 1, c: 2, b: 3} |
| DROP TABLE IF EXISTS `airports`; | |
| CREATE TABLE IF NOT EXISTS `airports` ( | |
| `code` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `name` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `cityCode` varchar(50) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `cityName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `countryName` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `countryCode` varchar(200) COLLATE utf8_turkish_ci DEFAULT NULL, | |
| `timezone` varchar(8) COLLATE utf8_turkish_ci DEFAULT NULL, |
| // @source: http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript | |
| function randomStr(m) { | |
| var m = m || 9; s = '', r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
| for (var i=0; i < m; i++) { s += r.charAt(Math.floor(Math.random()*r.length)); } | |
| return s; | |
| }; |
| function convertMS(ms) { | |
| var d, h, m, s; | |
| s = Math.floor(ms / 1000); | |
| m = Math.floor(s / 60); | |
| s = s % 60; | |
| h = Math.floor(m / 60); | |
| m = m % 60; | |
| d = Math.floor(h / 24); | |
| h = h % 24; | |
| return { d: d, h: h, m: m, s: s }; |