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
=force-new-lines-for-long-words | |
-ms-word-break: break-all | |
word-break: break-all | |
word-break: break-word | |
-webkit-hyphens: auto | |
-moz-hyphens: auto | |
hyphens: auto |
const prefetch = document.createElement('link'); | |
prefetch.setAttribute('rel', 'prefetch'); | |
prefetch.setAttribute('href', url); | |
document.head.appendChild(prefetch); |
const url = origin + '/amp_preconnect_polyfill?' + Math.random(); | |
const xhr = new XMLHttpRequest(); | |
xhr.open('HEAD', url, true); | |
xhr.send(); |
//trimmed down version of jack lawsons mediator | |
(function (root) { | |
// We'll generate guids for class instances for easy referencing later on. | |
// Subscriber instances will have an id that can be refernced for quick | |
// lookups. | |
function guidGenerator() { | |
var S4 = function () { | |
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); |
const curry = fn => (...args) => fn.bind(null, ...args); | |
const map = curry((fn, arr) => arr.map(fn)); | |
const join = curry((str, arr) => arr.join(str)); | |
const toLowerCase = str => str.toLowerCase(); | |
const split = curry((splitOn, str) => str.split(splitOn)); |
const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x); | |
const fn1 = s => s.toLowerCase(); | |
const fn2 = s => s.split('').reverse().join(''); | |
const fn3 = s => s + '!' | |
const newFunc = pipe(fn1, fn2, fn3); | |
const result = newFunc('Time'); // emit! |
const toSlug = pipe( | |
split(' '), | |
map(toLowerCase), | |
join('-'), | |
encodeURIComponent | |
); | |
console.log(toSlug('JS Cheerleader')); // 'js-cheerleader' |
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env | |
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced | |
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start | |
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running. | |
# Add the following to your shell init to set up gpg-agent automatically for every shell | |
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then | |
source ~/.gnupg/.gpg-agent-info | |
export GPG_AGENT_INFO | |
else |
// Create our server | |
var server; | |
server = http.createServer(function(req,res){ | |
// Set CORS headers | |
res.setHeader('Access-Control-Allow-Origin', '*'); | |
res.setHeader('Access-Control-Request-Method', '*'); | |
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET'); | |
res.setHeader('Access-Control-Allow-Headers', '*'); | |
if ( req.method === 'OPTIONS' ) { | |
res.writeHead(200); |