Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
protected void renderYUI3Instance(HtmlContentWriter container, String component, String constructor) throws IOException {
writeInlineScript(container, new YUI3Instance(component, constructor));
}
// …
private class YUI3Instance implements TextContent {
private String component;
protected void writeDocument(HtmlContentWriter html) throws IOException {
HtmlContentWriter head, body, content;
head = html.head();
head.title().text("Tips You Made at TipTheWeb");
head.link(REL_STYLESHEET, TYPE_TEXT_CSS, relHref(getWebutils().getLocation("reset.css", "base.css")));
head.link(REL_STYLESHEET, TYPE_TEXT_CSS, relHref(
getResources().getLocation(
"style/style.css",
@ericf
ericf / URL.js
Created December 10, 2010 21:34
Possible APIs for URL.js
URL('exmaple.com').toString() // http://example.com/
// Accessor methods
URL('example.com').protocol(); // http:
URL('foo.example.com').host(); // foo.example.com
URL('foo.example.com').domain(); // example.com
URL('example.com').path(); // /
// or getter style
URL('example.com').getProtocol(); // http:
URL('foo.example.com').getHost(); // foo.example.com
@ericf
ericf / URL_tests.js
Created December 10, 2010 21:44
Current Test Suite
/**
* Link Tests
*/
YUI.add('ttw-link-test', function(Y){
var matchSuite = new Y.Test.Suite('Link - Matching'),
sanitizeSuite = new Y.Test.Suite('Link - Sanitize');
// *** Protocol Match TestCase *** //
@ericf
ericf / gist:739815
Created December 13, 2010 23:58
Beginnings of Guide Widget Module
/**
* Guide
*
* Provides an interactive Guide Widget (Overlay) to present content in a series of Steps.
*
* GuideSteps are Widgets with WidgetStdMod support and are children to a Guide.
* These Steps also have WidgetPositionAlign support which is overloaded to reference related content for the Step;
* meaning a GuideStep can be aligned with it’s related content on the page, and when active,
* the Guide Overlay will position itself according the currently-selected Step’s defined alignment.
_initWelcomeGuide : function () {
var guide;
guide = new Y.TTW.Guide({
srcNode : '#welcome-guide',
render : true,
visible : true,
centered : true,
Y.MyWidget = Y.Base.create('myWidget', Y.Widget, [], {
// *** Prototype *** //
bindUI : function () {
this.after('myAttrChange', this._afterMyAttrChange);
},
syncUI : function () {
var guide;
guide = new Y.TTW.Guide({
srcNode : '#welcome-guide',
width : '500px',
tabIndex : 0,
render : true,
centered : true,
zIndex : 250,
head.link(REL_STYLESHEET, TYPE_TEXT_CSS, relHref(
combo()
.add(webutils(),
"reset.css",
"base.css")
.add(yui3(),
"cssgrids/grids-min.css")
.add(resources(),
"style/style.css",
"style/chrome.css",
head.link(REL_STYLESHEET, TYPE_TEXT_CSS, relHref(
combo()
.add(webutils(),
"reset.css",
"base.css")
.add(yui3(),
"cssgrids/grids-min.css")
.add(resources(),
"style/style.css",
"style/chrome.css",