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
// from http://stackoverflow.com/questions/13483430/how-to-make-rounded-percentages-add-up-to-100 | |
function foo(l, target) { | |
var off = target - _.reduce(l, function(acc, x) { return acc + Math.round(x) }, 0); | |
return _.chain(l). | |
sortBy(function(x) { return Math.round(x) - x }). | |
map(function(x, i) { return Math.round(x) + (off > i) - (i >= (l.length + off)) }). | |
value(); | |
} |
/** | |
* Bootstrap File Input directive wrapper. | |
*/ | |
angular.module('bfi', []) | |
.directive('bfi', function () { | |
return { | |
restrict: 'A', | |
link: function (scope, element, attrs) { | |
element.bootstrapFileInput(); | |
} |
<?php | |
require_once __DIR__.'/../vendor/autoload.php'; | |
require_once __DIR__.'/boot.php'; | |
use Silex\Application; | |
use Symfony\Component\HttpFoundation\Request; | |
use Synfony\Component\HttpFoundation\Response; | |
$app = new Application(); |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
// from http://ryanmorr.com/the-state-of-browser-detection/ | |
if('opera' in window && ({}).toString.call(window.opera) === '[object Opera]'){ | |
// detect Opera 14- | |
} | |
if('operamini' in window && ({}).toString.call(window.operamini) === '[object OperaMini]'){ | |
// detect Opera Mini | |
} | |
if('PalmSystem' in window){ | |
// detect webOS | |
} |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"