Skip to content

Instantly share code, notes, and snippets.

View caridy's full-sized avatar

Caridy Patiño caridy

  • Salesforce, Inc.
  • Miami, FL.
  • X @caridy
View GitHub Profile
@caridy
caridy / README.md
Last active December 20, 2015 16:28
Patching YUI Core Modules with `express-yui`

What is this?

This is a gist to showcase how to patch a yui core module when using express-yui, in this particular case, patching the router module by defining a new module router-patched as a replacement for the original module core module router.

Instalation

npm install
node app.js
@caridy
caridy / README.md
Last active December 20, 2015 07:19
express-routes-notes

What is this?

This is a prototype for the low-level api to serialize express routes into the client side.

Installation

npm install
node simple.js
node complex.js
@caridy
caridy / README.md
Last active December 19, 2015 18:48

What is this?

This is a script that you can add to your application to generating yui meta data and compiling yui modules using express-yui and locator. As a result, a build folder will be generated with everything that was compiled.

How does this work?

Locator walks the folder structure for your app, and finds any yui module, including build.json or just traditional *.js files with the corresponding YUI.add() statement. Generating the result of the operation as well as the metadata associated to each module.

Under the hood, it uses shifter to generate almost everything that is needed.

@caridy
caridy / app.js
Created May 22, 2013 16:51
overruling the method before calling express router
var express = require('express'),
app = express();
app.use(function (req, res, next) {
console.log(req);
req.method = 'GET';
next();
});
app.get('/', function (req, res, next) {
/*jslint anon:true, sloppy:true, nomen:true*/
YUI.add('clickMojit', function(Y, NAME) {
/**
* The clickMojit module.
*
* @module clickMojit
*/
/**
[
{
"settings": [ "master" ],
"appPort": "8666",
"specs": {
"frame": {
"type": "HTMLFrameMojit",
"config": {
"deploy": true,
"child": {
@caridy
caridy / template-registration.md
Last active December 17, 2015 04:08
Template registration process in YUI

This gist was updated based on the discussion here : https://groups.google.com/forum/?fromgroups=#!topic/yui-contrib/cUpVvtoUBa8

Template Registration

With the ability to precompile templates into javascript and the abtraction layer provided by Y.Template to normalize the api to render those templates, we got one step closer to create applications that can be template language agnostic.

The premise here is to create a YUI Application that references templates by name and call for render when needed without having to know what engine to use, or what file generated the compiled template, or what api should be used for a particular template.

In order to facilitate this, we should have a centralized registration mechanism used by the application to register any template that is provisioned, in which case we can decouple the provisioning process from the actual rendering process.

var m1 = function (req, res, next) {
next();
};
var m2 = function (req, res, next) {
next();
}
var m3 = function (req, res, next) {
next();
/*jslint nomen:true, indent: 4, plusplus: true, browser: true */
/*
* Based on: http://yuilibrary.com/yui/docs/yui/nodejs-dom.html
*/
YUI.add('jsdom-node', function (Y) {
'use strict';
var jsdom = require(__dirname + '/../../../node_modules/jsdom'),
dom,
app.use(statichandler.public('yui', 'path/to/yui'));
/yui/ (public-path)
app.use('/static/', statichandler.public('yui', 'path/to/yui'));
/static/ yui/ (public-path)
app.use('/static/', statichandler.map('app', {
'foo.js': __dirname + '/foo.js';
}));
/static/ app/ (protected-path)