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
YUI.add('metas', function (Y, NAME) {
Y.applyConfig({
groups: {
app: Y.merge((Y.config.groups && Y.config.groups.app) || {}, {
modules: {
foo: {
path: "assets/foo.js",
requires: ["node"]
},
bar: {
/*jslint anon:true, sloppy:true, nomen:true*/
YUI.add('helperMojit', function(Y, NAME) {
function toLinkHelper(title, url) {
return "<a href='" + url + "'>" + title.toLowerCase() + "</a>";
}
function highlightModuleHelper(mods, highlighted_module) {
var mod_names = [];
{
"yui": {
"config": {
"groups": {
"app": {
"base": "/static/",
"comboBase": "/combo~",
"comboSep": "~",
"root": "/static/",
"combine": true
var HB = require('yui/handlebars').Handlebars;
var Y = require('yui/base');
var helpers = {
foo: function () {
return 2;
}
};
var t = HB.compile('{{foo}}/{{bar}}/{{#baz}}{{xyz}}{{/baz}}');
=========================
Configuring YUI in Mojito
=========================
.. _yui_config-intro:
Overview
========
Mojito allows you to configure the YUI seed file and use YUI groups for dynamically
{
"name": "mojito-mojit-foo",
"description": "Mojit Foo Description",
"version": "0.1.0",
"author": {
"name": "Caridy Patino",
"email": "[email protected]"
},
"yahoo": {
"mojito": {
/*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'),
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) {
@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
@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']});