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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
# ZSH_THEME="robbyrussell" | |
ZSH_THEME="gentoo" | |
# Example aliases |
//usage | |
withAdvice.call(targetObject); | |
//mixin augments target object with around, before and after methods | |
//method is the base method, advice is the augmenting function | |
withAdvice: function() { | |
['before', 'after', 'around'].forEach(function(m) { | |
this[m] = function(method, advice) { | |
if (typeof this[method] == 'function') { | |
return this[method] = fn[m](this[method], advice); |
var Loader = (function () { | |
function Loader(options) { | |
this.options = options; | |
if (resource.scripts && resource.baseUrl) { | |
for (var i = 0; i < this.options.scripts.length; i++) { | |
this.load('js', this.options.scripts[i]); | |
} | |
for (var i = 0; i < this.options.stylesheets.length; i++) { | |
this.load('css', this.options.stylesheets[i]); | |
} |
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); // Used to stream bundle for further handling | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var gulpif = require('gulp-if'); | |
var uglify = require('gulp-uglify'); | |
var streamify = require('gulp-streamify'); | |
var notify = require('gulp-notify'); | |
var concat = require('gulp-concat'); | |
var cssmin = require('gulp-cssmin'); |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
// Flyweight.js - Copyright Addy Osmani, 2012. | |
// Consider public domain | |
// My implementation in JS of this: | |
// http://en.wikipedia.org/wiki/Flyweight_pattern | |
// Simulate pure virtual inheritance/'implement' keyword for JS | |
Function.prototype.implementsFor = function (parentClassOrObject) { | |
if (parentClassOrObject.constructor == Function) { | |
// Normal Inheritance | |
this.prototype = new parentClassOrObject; |
import Service from 'path/to/service'; | |
import 'jasmine-ajax' | |
describe('Service', () => { | |
let request, promise; | |
let instance = Service; | |
let payload = {foo:'bar'}; | |
let path = '/path'; | |
let callback = jasmine.createSpy('callback'); |
class PromiseSimple { | |
constructor(executionFunction) { | |
this.promiseChain = []; | |
this.handleError = () => {}; | |
this.onResolve = this.onResolve.bind(this); | |
this.onReject = this.onReject.bind(this); | |
executionFunction(this.onResolve, this.onReject); | |
} |