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
Created December 10, 2012 22:26
Mojito 0.5.0 preliminar doc on YUI App Group settings

YUI App Group

Starting on Mojito 0.5.0, we introduced a special group called app as part of the loader metadata. This new setting will group all the yui modules defined in mojito core and in the application, and will hold a series of settings and configurations that will define how YUI will deal with those modules when they are needed.

Groups are an important part of the YUI Loader configuration because they allow us to define buckets of files that could be loaded from different mediums and sources. For more details about the group configuration, reference to the YUI Groups config api: http://yuilibrary.com/yui/docs/api/classes/config.html#property_groups

By default, YUI defines 3 groups: default, gallery and yui2. In mojito, we introduce a fourth one, called app, and it defines anything that is part of the application or any of its dependencies, including mojito core modules. As a regular practice, mojito will assume few things about this group, and in many case, you don't need to worry about cust

@caridy
caridy / build.sh
Created December 13, 2012 20:55 — forked from isao/build.sh
#!/bin/sh -ex
appname=${1:-hybrid}
bldname=$appname-bld
statdir=yahoo.application.$appname
mojitodir=/Users/caridy/repo/mojito
pwd
mojito create app hybrid $appname
@caridy
caridy / locater.md
Last active December 11, 2015 03:48
Thoughts on YUI Locater

Locater (former ResourceStore in Mojito)

Locater is a filesystem abstraction that is meant to provide access to configurations and resources that describes a YUI App.

The responsibilities of the Locater are:

  • To explore and flatten the structure of a YUI App.
  • To watch and cache meta information to speed up the warm up process for the app.
  • To provide meta information about logical pieces in the application (aka mojits).
  • To provide meta information about specific resorces.
/*
* Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved.
* Copyrights licensed under the New BSD License.
* See the accompanying LICENSE file for terms.
*/
/*jslint anon:true, sloppy:true, nomen:true*/
/*global YUI*/
@caridy
caridy / deep-merge.js
Created January 22, 2013 18:08
Experimenting with deep merge leveraging prototypal inheritance instead of pure JSON objects for YCB
function heir (o) {
function F() {}
F.prototype = o;
return new F();
}
function heirDeep (o) {
var dest,
i;
@caridy
caridy / bar.js
Last active December 11, 2015 16:39
This example demonstrate that YUI Loader on the server side will dynamically resolve dependencies, which means requirements do not need to be part of the meta set through `applyConfig`.
YUI.add('bar', function (Y, NAME) {
Y[NAME] = true;
console.log(NAME);
}, '', {requires: ['baz']});
@caridy
caridy / benchmark-and-benchtable-abstraction.js
Last active December 11, 2015 18:38
Boilerplate to write benchmarks and benchtables in NodeJS.
/*jslint node:true, nomen:true, stupid: true */
'use strict';
var Benchmark = require('benchmark').Benchmark,
Benchtable = require('benchtable');
function getSuite(testName) {
var suite;
// enabling benchmark suite
place-controller.js
handlePlaceCoordinator: function (runtime) {
var self = this,
place = self.models.get('place'),
photos = self.models.get('photos'),
placeId = runtime.params.id;
if (place.get('id') !== placeId) {
/*jslint node:true*/
'use strict';
var express = require('express'),
mojito = require('mojito-server'),
locator = require('./locator.js'),
config = require('./conf/config'),
middleware = require('./lib/middleware'),
{
"name": "mojito-mojit-foo",
"description": "Mojit Foo Description",
"version": "0.1.0",
"author": {
"name": "Caridy Patino",
"email": "caridy@yahoo-inc.com"
},
"yahoo": {
"mojito": {