Skip to content

Instantly share code, notes, and snippets.

View mattparker's full-sized avatar

Matt Parker mattparker

View GitHub Profile
@mattparker
mattparker / mediaViewScrollview.js
Created September 25, 2012 14:11
scrollview View wrapper
/**
*
*
*
*
* mediaViewScrollview
*
*
*
*
@mattparker
mattparker / Y.Array.set.js
Created August 30, 2012 12:43
YUI Y.Array set methods (intersect, diff, union)
YUI.add("arraySet", function (Y) {
"use strict";
var A = Y.Array,
L = Y.Lang,
iO = A.indexOf;
/**
@mattparker
mattparker / RelatedModelList.js
Created October 20, 2011 13:05
RelatedModelList - an idea to join Models to other ModelLists
YUI.add('RelatedModelList', function (Y) {
/**
* Intended as augmentation of Model to enable easy loading
* of related ModelList instances. For example, an author Model
* may have a BookList ModelList.
*
* The ModelList that is instantiated will need to know what
* to do to load, save etc the data: this is up to the implementer.
@mattparker
mattparker / 1. ArrayList with events.js
Created September 30, 2010 12:47
YUI3: A simple example adding events to Base extensions augmented by ArrayList
/**
* Y.ArrayListEvents fires some events for ArrayList.
* 8/10/10: update - Added events for everything, pretty much,
* and added nicer signatures for subscribers
* Also changed the name slightly (from Y.ArrayListEventProvider)
*/
Y.ArrayListEvents = Y.Base.create(
'arraylistevents',
Y.Plugin.Base,
// A rough idea for a RecordSetIndex plugin
// Filtering, searching, sorting on the host RecordSet could use the index if
// it's available (possibly creating it the first time someone does a sort or whatever)
// So RecordSet.filter() should be something like:
/*
filter: function(k,v) {
if (this.hasIndex(k)) {
return this.getIndex(k).find(v);
} else {
// proceed as normal!
YUI.add('fielddef', function (Y) {
/**
* A field definition sets up everything except the actual value of a field.
*
*/
Y.FieldDef = Y.Base.create(
// Note that _disabledRules is also added to constructor.
// These are the public API methods.
/**
* Enable a particular rule (or several) that's previously been disabled.
* The selector parameter can be a RegExp; each rule matching the pattern
* will be enabled
* @param sel {String} String or RegExp to match to selectors to enable
* @method enableRule
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>YUI3 testbed</title>
<script type="text/javascript" src="js/shCore.js"></script>
<script type="text/javascript" src="js/shBrushJScript.js"></script>
var menuitems = [ {text:"item 1", url: "www.1.com"}, {text:"item 2", url: "www.1.com"}, {text:"item 3", url: "www.1.com"} ];
oMenu = new YAHOO.widget.Menu( "amenu", {
fixedcenter: true,
lazyload: true,
autosubmenudisplay: true
});
oMenu.addItems(menuitems);
oMenu.render("mymenu");
oMenu.show();
@mattparker
mattparker / a really simple, drag-droppable YUI3 treeview
Created April 7, 2010 08:44
A really simple, drag-drop YUI3 treeview
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- @(#) $Id$ -->
<head>
<title>Extension of sortable lists as a tree view</title>
<!-- Dependency -->
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.1.0/build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="http://yui.yahooapis.com/3.1.0/build/yui/yui.js"></script>
<!--