Skip to content

Instantly share code, notes, and snippets.

View ericf's full-sized avatar

Eric Ferraiuolo ericf

View GitHub Profile
@ericf
ericf / gist:1203819
Created September 8, 2011 16:24
YUI Open Hours Agenda — 9/8
YUI().use('model', 'model-list', function (Y) {
Y.Tag = Y.Base.create('tag', Y.Model, [], {}, {
ATTRS: {
name: {}
}
});
Y.Tags = Y.Base.create('tags', Y.ModelList, [], { model: Y.Tag });
// For Y.Foo
// Class extensions that will be used in the base class
function ExtA() {}
...
Y.FooExtA = ExtA;
// Base Class definition
function FooBase() {}
...
var comboServer = require('combohandler/lib/server'),
port = process.env.PORT || 3001,
app = comboServer({
roots: {
'/': __dirname + '/build'
}
});
app.listen(port, function () {

Preferential ordering of server and browser capabilities to determine if client- side routing should happen and enhance an application's user experience.

Format: (app has capable server) && (browser has pushState) => (should route)

  1. server && html5 //=> routes
  2. server && !html5 //=> !routes
  3. !server && html //=> routes
  4. !server && !html5 //=> routes
YUI().use('charts', 'app-base', function (Y) {
var ChartView, StatsView, app;
ChartView = Y.Base.create('chartView', Y.View, [], {
render: function () {
this.chart = new Y.Chart({
dataProvider: [],
render : this.get('container')
});

App Framework URL Jazz

Gathered thoughts about URL woes at the various levels in our stack of components which deal with them. URLs are hard to get right, but it is important to do so.

Application-level URL Handling

Public methods that change the URL:

@ericf
ericf / gist:1421955
Created December 2, 2011 05:47
Super basic Y.App example
// Imagine that `Y.User`, `Y.UsersView`, and `Y.UserView` have been defined.
var app = new Y.App({
views: {
users: {
type : Y.UsersView,
preserve: true
},
user: {
type : Y.UserView,
@ericf
ericf / gist:1424518
Created December 2, 2011 19:31
I need an idea for a Y.App example

Y.App Example

I need to build an example app using the new Y.App class and need help coming up with a good idea.

Add your ideas in the comments…

"Requirements"

YUI().use('app', 'handlebars', 'jsonp', function (Y) {
var GithubSync,
Contributor, ContributorList, Repo, RepoList, User,
ContributorListView, RepoView, RepoListView, UserView,
HomePageView, UserPageView, RepoPageView,
ContributorsApp;
// -- GithubSync ---------------------------------------------------------------