Skip to content

Instantly share code, notes, and snippets.

View tivac's full-sized avatar
💭
👋🏻🙃

Pat Cavit tivac

💭
👋🏻🙃
View GitHub Profile
@tivac
tivac / transform-buttondir.js
Created August 6, 2012 17:48
View transforms
/*global YUI:true */
YUI.add("transform-buttondir", function(Y) {
Y.namespace("GW2.Transforms").buttonDir = function(models, dir) {
return Y.Array.map(models, function(item) {
if(item.quantities) {
//if a dir was specified set every quantity to that
if(dir) {
item.quantities = Y.Array.map(item.quantities, function(quantity) {
quantity.dir = dir;
@tivac
tivac / extension-model-reset.js
Created June 22, 2012 20:58
More powerful Model.reset()
ResetExtension = function(){};
ResetExtension.prototype = {
reset : function(name, options) {
var self = this,
attributes = {};
//allow old-style string name/string name + options/just options
if(Y.Lang.isString(name)) {
attributes[name] = self._state.get(name, "initValue");
} else if(Y.Lang.isObject(name)) {
@tivac
tivac / function-scope.js
Created June 15, 2012 19:02
YUI Compressor example
//function scope
(function() {
var fooga = "booga";
var nooga = "looga";
}());
//Compression Result
(function(){var b="booga";var a="looga"}());
@tivac
tivac / home-carousel.handlebars.js
Created May 15, 2012 20:07
Combo-handler served Handlebars files
@tivac
tivac / _README.md
Last active October 4, 2015 11:38
Parent/Child Y.View extension

Parent/Child Y.Views

As I worked with Y.App it became clear that while Y.View is a great abstraction it would be easy to overwhelm a single instance with way too much functionality. This is my attempt to solve that issue by allowing multiple child views to be attached to a single parent view via an extension.

Usage

The extension is mixed into the parent view like any other extension using Y.Base.create.

var Parent = Y.Base.create("view", Y.View, [
@tivac
tivac / dabblet.css
Created April 12, 2012 22:55
Untitled
html { background: #ACACAC; }
.yui3-tab-panel{display:none}.yui3-tab-panel-selected{display:block}.yui3-tabview-list,.yui3-tab{margin:0;padding:0;list-style:none}.yui3-tabview{position:relative}.yui3-tabview,.yui3-tabview-list,.yui3-tabview-panel,.yui3-tab,.yui3-tab-panel{zoom:1}.yui3-tab{display:inline-block;*display:inline;vertical-align:bottom;cursor:pointer}.yui3-tab-label{display:block;display:inline-block;padding:6px 10px;position:relative;text-decoration:none;vertical-align:bottom}.yui3-skin-sam .yui3-tabview-list{border:solid #2647a0;border-width:0 0 5px;zoom:1}.yui3-skin-sam .yui3-tab{margin:0 .2em 0 0;padding:1px 0 0;zoom:1}.yui3-skin-sam .yui3-tab-selected{margin-bottom:-1px}.yui3-skin-sam .yui3-tab-label{background:#d8d8d8 url(../../../../assets/skins/sam/sprite.png) repeat-x;border:solid #a3a3a3;border-width:1px 1px 0 1px;color:#000;cursor:pointer;font-size:85%;padding:.3em .75em;text-decoration:none}.yui3-skin-sam .yui3-tab-label:hover,.yui3-skin-sam .yui3-tab-label:focus{background:#bfdaff url(
@tivac
tivac / group-proposed-format.js
Created March 31, 2012 04:55
Experimenting with shared requires at group & top levels of a YUI config object.
YUI_config = {
requires : [
"base",
"view"
],
groups : {
"home" : {
modules : {
/* Home views */
@tivac
tivac / preloading.js
Created December 19, 2011 21:52
Using Y.Loader to preload modules
var l = new Y.Loader(Y.merge(Y.config, { require : [ "your", "modules", "here" ] })),
o = l.resolve(true);
//now o.js & o.css contain the URLs you should preload
@tivac
tivac / original-config-min.js
Created December 19, 2011 07:55
String abstraction testing
/*
* YUI Compressor Stats
* before: 10137
* after compression: 6090
* compression ratio: 40%
* after compression and gzip: 1483
* compression and gzip ratio: 85%
*/
var market_config={groups:{"market-controls":{combine:true,comboBase:"/combo/_",root:"/tradingpost/game/js/controls/",modules:{"market-itemgrid":{path:"itemgrid.3310824482.js",requires:["node","event","transition","widget-base","base","lib-coins"]},"market-itemgrid-sort":{path:"itemgrid-sort.125758115.js",requires:["base-build","plugin"]},"market-itemgrid-filter":{path:"itemgrid-filter.2222969562.js",requires:["base-build","plugin","node","autocomplete-base","autocomplete-filters"]},"market-itemgrid-prices":{path:"itemgrid-prices.3718117909.js",requires:["plugin","base-build","io-base","json-parse","lib-coins","node"]},"market-listings":{path:"listings.691629048.js",requires:["node","widget-base","base","lib-coins"]},"market-listings-highlighter":{path:"listings-highlighter.3339239668.js",requires:["base","base-build","plugin","node"]},"
@tivac
tivac / config.js
Created December 2, 2011 18:44
Patching YUI module bugs
var config = {
groups : {
patches : {
base : "/js/patches/",
modules : {
"datatable-patches" : {
path : "datatable.js",
condition : {
name : "datatable-patches",
trigger : "datatable-base",