Originally just 8 Sass mixins you must have in your toolbox, now there are more!
Usage:
// Pretty fast - http://jsperf.com/select-vs-natives-vs-jquery | |
/* | |
By, shortcuts for getting elements. | |
*/ | |
var By = { | |
id: function (id) { return document.getElementById(id) }, | |
tag: function (tag, context) { | |
return (context || document).getElementsByTagName(tag) | |
}, | |
"class": function (klass, context) { |
#export PATH=$PATH:/Library/PostgreSQL/8.4/bin/ | |
dropdb -U postgres mydb | |
createdb -E UTF8 -U postgres mydb | |
psql -U postgres -d mydb < mydb-snapshot.sql | |
# or pg_restore -U postgres --dbname mydb --verbose mydb-snapshot.backup | |
# or pg_restore -U postgres --dbname mydb --verbose --no-owner mydb-snapshot.backup |
/** | |
* Module dependencies. | |
*/ | |
var path = require('path') | |
// prompt | |
exports.PS1 = function(){ |
// globals.js | |
// https://gist.github.com/pocotan001/6305714 | |
// Finding improper JavaScript globals | |
(function() { | |
var prop, cleanWindow, | |
globals = new function globals() {}, | |
body = document.body, | |
iframe = document.createElement('iframe'), | |
ignore = { |
/* ----------------------------------------------------------------------------- | |
### Mocha Guide to Testing ### | |
Objective is to explain `describe()`, `it()`, and `before()`/etc hooks. | |
1. `describe()` is merely for grouping, which you can nest as deep | |
as is required. | |
2. `it()` is a test case. |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
Originally just 8 Sass mixins you must have in your toolbox, now there are more!
Usage:
These tools inject a breakpoint, console.log
or console.count
in any function you want to spy on via
stopBefore('Element.prototype.removeChild')
or ditto stopAfter
, logBefore
/ logAfter
/ logAround
/ logCount
.
Works in Chrome DevTools and Safari Inspector; Firefox dev tools reportedly less so.
What are we trying to observe? Raw object data.
// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
/*jshint asi:true, proto:true */ | |
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document) | |
Node.prototype.on = window.on = function(names, fn) { | |
var self = this | |
names.split(' ').forEach(function(name) { |