Skip to content

Instantly share code, notes, and snippets.

addyosmani /
Last active Nov 25, 2020 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

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

calbrecht / PhpStormVagrantPhpUnit.php
Last active Dec 24, 2015
Run PhpUnit from wihtin PhpStorm through vagrant on virtual machine. Use this file as Custom Loader. See
View PhpStormVagrantPhpUnit.php
/** Full path to project dir on host */
isset($_SERVER['HOST_DIR']) or $_SERVER['HOST_DIR'] = realpath(__DIR__ . '/../../');
/** Full path to vagrant directory on host */
$_SERVER['VAGRANT_DIR'] = $_SERVER['HOST_DIR'] . '/vagrant';
/** Full path to project dir on virtual machine */
$_SERVER['GUEST_DIR'] = '/path/to/project/on/vm';
jakemmarsh / filters.js
Created Jul 16, 2013
AngularJS filter to create links out of URLs
View filters.js
app.filter('parseUrl', function() {
var //URLs starting with http://, https://, or ftp://
replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim,
//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim,
//Change email addresses to mailto:: links.
replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
return function(text, target, otherProp) {
angular.forEach(text.match(replacePattern1), function(url) {
raveren / cryptographically_secure_random_strings.php
Last active Oct 14, 2020
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:
View cryptographically_secure_random_strings.php
function random_text( $type = 'alnum', $length = 8 )
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
case 'hexdec':
joshdmiller / UserService.js
Created Mar 15, 2013
A starting point for an $http-backed RESTful model in AngularJS.
View UserService.js
.factory( 'UserService', [ '$http', function ( $http ) {
var url = '/api/users';
* This is the private API.
// get a list of users
function query () {
return $http.get( url );
You can’t perform that action at this time.