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
| function check_for_virtual_env { | |
| [ -d .git ] || git rev-parse --git-dir &> /dev/null | |
| if [ $? == 0 ]; then | |
| local ENV_NAME=`basename \`pwd\`` | |
| if [ "${VIRTUAL_ENV##*/}" != $ENV_NAME ] && [ -e $WORKON_HOME/$ENV_NAME/bin/activate ]; then | |
| workon $ENV_NAME && export CD_VIRTUAL_ENV=$ENV_NAME | |
| fi | |
| elif [ $CD_VIRTUAL_ENV ]; then |
| 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} |
| var duo = require('duo'); // https://github.com/duojs/duo | |
| var map = require('map-stream'); // https://github.com/dominictarr/map-stream | |
| var paths = { | |
| build: { | |
| src: { | |
| jsApp: ['./src/js/main.js'], | |
| jsClient: ['./src/js/client.js'] | |
| }, |
| # Usage: IE={box} vagrant up | |
| # | |
| # Eg. IE=XPIE6 vagrant up | |
| boxes = { | |
| "XPIE6" => "http://aka.ms/vagrant-xp-ie6", | |
| "XPIE8" => "http://aka.ms/vagrant-xp-ie8", | |
| "VistaIE7" => "http://aka.ms/vagrant-vista-ie7", | |
| "Win7IE8" => "http://aka.ms/vagrant-win7-ie8", | |
| "Win7IE9" => "http://aka.ms/vagrant-win7-ie9", |
| /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| * Anchor Smooth Scroll - Smooth scroll to the given anchor on click | |
| * adapted from this stackoverflow answer: http://stackoverflow.com/a/21918502/257494 | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
| angular.module('yourapp').directive('anchorSmoothScroll', function($location) { | |
| 'use strict'; | |
| return { | |
| restrict: 'A', | |
| replace: false, |
| var express = require('express'), | |
| app = express(); | |
| app.listen(80); | |
| app.get('/', function(req, res){ | |
| var ua = req.header('user-agent'); | |
| // Check the user-agent string to identyfy the device. | |
| if(/mobile|iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile|ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(ua)) { | |
| res.sendfile(__dirname + '/mobile.html'); | |
| } else { | |
| res.sendfile(__dirname + '/index.html'); |
| var gulp = require('gulp'), | |
| sass = require('gulp-sass'), | |
| browserify = require('gulp-browserify'), | |
| concat = require('gulp-concat'), | |
| embedlr = require('gulp-embedlr'), | |
| refresh = require('gulp-livereload'), | |
| lrserver = require('tiny-lr')(), | |
| express = require('express'), | |
| livereload = require('connect-livereload') | |
| livereloadport = 35729, |
| // Q sample by Jeff Cogswell | |
| /*=========== | |
| We want to call these three functions in sequence, one after the other: | |
| First we want to call one, which initiates an ajax call. Once that | |
| ajax call is complete, we want to call two. Once two's ajax call is | |
| complete, we want to call three. | |
| BUT, we don't want to just call our three functions in sequence, as this quick |
| # Change YOUR_TOKEN to your prerender token | |
| # Change http://example.com (at the end of the last RewriteRule) to your website url | |
| <IfModule mod_headers.c> | |
| RequestHeader set X-Prerender-Token "YOUR_TOKEN" | |
| </IfModule> | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On |