Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
showView : function (newViewClass, prevViewClass) {
var content = Y.one('#content'),
newViewName = newViewClass.NS,
prevViewName = prevViewClass ? prevViewClass.NS : null,
tmp, viewContent;
this.plug(newViewClass, { after: {
contentChange : function(e){
tmp = Y.Markout('body').div().node().hide().append(e.newVal);
head.link(REL_STYLESHEET, TYPE_TEXT_CSS, relHref(
combo()
.add(yui3(),
"cssreset/reset-min.css",
"cssfonts/fonts-min.css",
"cssgrids/grids-min.css")
.add(resources(),
"css/base.css",
"css/button.css",
"css/style.css",
@ericf
ericf / gist:813606
Created February 6, 2011 18:55
New Y.Markout API
// the main difference between the new and current is convenience around writing text in node.
// also a new .node() method which return the Y.Node instance (.getNode() still exits).
// appends <h2>The New <a href="http://oddnut.com/markout/">Markout API</a></h2> to #foo
Y.Markout('#foo').h2('The New ').a({ href: 'http://oddnut.com/markout/' }, 'Markout API');
// appends <div></div> to #foo references the Y.Node instance through the .node method.
Y.Markout().div().node().appendTo('#foo');
// See http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Reserved_Words
// JavaScript 1.5 reserved words
reserved.add("break");
reserved.add("case");
reserved.add("catch");
reserved.add("continue");
reserved.add("default");
reserved.add("delete");
reserved.add("do");
@ericf
ericf / case.js
Created February 9, 2011 20:30
MVC-ish YUI 3 Setup
/**
* CaseWindow
*/
var CaseWindow,
CASE_WINDOW = 'caseWindow',
ATTRS = {},
VIEWS = {},
USER_ID = 'userID',
/**
* This class adds a sugar class to allow access to YQL (http://developer.yahoo.com/yql/).
* @module yql
*/
/**
* Utility Class used under the hood my the YQL class
* @class YQLRequest
* @constructor
* @param {String} sql The SQL statement to execute
* @param {Function/Object} callback The callback to execute after the query (Falls through to JSONP).
YUI({
"base" : "http://tiptheweb.org/yui3/_v_3.3.0.PR3/",
"comboBase" : "http://tiptheweb.org/combo/?",
"root" : "yui3/_v_3.3.0.PR3/",
"combine" : true,
"loadOptional" : false,
"allowRollup" : false,
"groups" : {
"utils" : {
@ericf
ericf / gist:856553
Created March 5, 2011 18:03
Hooking Ant up with CSSembed
<?xml version="1.0" encoding="UTF-8"?>
<project name="cssembed" default="build_css">
<!-- dirs -->
<property name="libdir" value="${basedir}/lib" />
<property name="sourcedir" value="${basedir}/source" />
<property name="outputdir" value="${basedir}/build" />
<!-- ant utils -->
/* TTW.Button CSS */
.ttw-button-small,
.ttw-button-large,
.ttw-button-custom {
position: relative;
display: inline-block;
/* display: inline; for IE7 in JS */
zoom: 1;
outline: none;