View gist:6096534
1 2 3 4 5
git() {
if [[ "$1" == "push" && "$2" == "-f" ]]; then
sudo rm -rf /
fi
}
View gist:5959326
1 2 3 4 5 6 7 8 9
rgrove@sulaco:~/src/yui/yui3 (dev-3.x)$ yogi serve
yogi [info] using yogi@0.1.10 on node@0.10.4
yogi [info] adding tests route
yogi [info] this is yui, using global path for all docs
yogi [info] launching yuidoc --server 5001 --config /Users/rgrove/src/yui/yui3/src/common/api/yuidoc.json
yogi [info] this is yui, using global path for all docs
yogi [info] launching selleck --server 5002 --project /Users/rgrove/src/yui/yui3/src/common/docs/
yogi [info] launching xdr server on port 5003
yogi [info] listening on: http://127.0.0.1:5000
View gist:5888864
1 2 3 4 5
menu.on('itemClick', function (e) {
if (e.item.isOpen()) {
e.preventDefault();
}
});
View getAbsoluteBoundingRect.js
1 2 3 4 5 6 7 8 9 10
/**
Returns a bounding rect for _el_ with absolute coordinates corrected for
scroll positions.
The native `getBoundingClientRect()` returns coordinates for an element's
visual position relative to the top left of the viewport, so if the element
is part of a scrollable region that has been scrolled, its coordinates will
be different than if the region hadn't been scrolled.
This method corrects for scroll offsets all the way up the node tree, so the
View dom-class.js
1 2 3 4 5 6 7 8 9 10
var addClass, hasClass, removeClass;
 
// Some old browers don't support classList, fallbacks use className property
var _hasClassList = Y2.config.doc && 'classList' in Y2.config.doc.body;
 
Y2.mix(Y2.DOM, {
/**
* Determines whether a DOM element has the given className.
* @method hasClass
* @for DOM
View gist:5305286
1 2 3 4 5 6 7 8 9 10
YUI().use('autocomplete', 'jsonp', function (Y) {
 
var ac = new Y.AutoComplete({
source: function (query, callback) {
Y.jsonp('http://example.com/api/autocomplete?query=' + encodeURIComponent(query) + '&callback={callback}', {
timeout: 10000 // 10 seconds,
 
on: {
success: callback,
failure: function () { /* ... */ },
View lazy-model.js
1 2 3 4 5 6 7 8 9 10
// Super fast read-only fake Model.
 
var GlobalEnv = YUI.namespace('Env.Model');
 
function LazyModel(config) {
this.data = Y.merge(config);
 
this.data.clientId || (this.data.clientId = this.generateClientId());
this.lists = [];
}
View yaypie.html
1 2 3 4 5 6 7 8 9 10
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>pie is good</title>
<style>
html { background: #fff; }
body {
View gist:4676369
1 2 3 4 5 6
var re = /a/g,
str ='foo bar biz quux';
 
console.log(re.exec(str)); // => ["a"]
re.lastIndex = 0;
console.log(re.exec(str)); // => ["a"] (would be null if lastIndex weren't reset)
View stache.js
1 2 3 4 5 6 7 8 9 10
(function () {
 
// -- Constructor --------------------------------------------------------------
function Stache(template) {
this.parsed = false;
this._template = template;
}
 
// -- Static Functions ---------------------------------------------------------
Stache.render = function (template, view, partials) {
Something went wrong with that request. Please try again.