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("loader",function(Y){YUI.Env[Y.version].modules=YUI.Env[Y.version].modules||{"mojito":{"requires":[]},"json-stringify":{"requires":["yui-base"]},"array-extras":{"requires":["yui-base"]},"mojito-util":{"requires":["array-extras","json-stringify","mojito"]},"mojito-view-renderer":{"requires":["mojito"]},"oop":{"requires":["yui-base"]},"event-custom-base":{"requires":["oop"]},"mojito-action-context":{"requires":["mojito","json-stringify","event-custom-base","mojito-view-renderer","mojito-util"]},"mojito-resource-store-adapter":{"requires":["mojito-util","json-stringify"]},"mojito-dispatcher":{"requires":["mojito-action-context","mojito-util","mojito-resource-store-adapter"]},"querystring-parse":{"requires":["yui-base","array-extras"]},"querystring-stringify":{"requires":["yui-base"]},"mojito-mojit-proxy":{"requires":["mojito","mojito-util","querystring-parse","querystring-stringify"]},"dom-core":{"requires":["oop","features"]},"dom-base":{"requires":["dom-core"]},"selector-native":{"requires":["dom-base"
{
"hello": {
"results": [{
"passed": 1,
"failed": 0,
"total": 1,
"ignored": 0,
"duration": 12,
"type": "report",
"name": "UseCases: hello",
<!DOCTYPE HTML>
<html>
<head>
<script src="http://yui.yahooapis.com/combo?3.7.3/yui-base/yui-base.js&3.7.3/loader-base/loader-base.js"></script>
<script>
YUI.add('loader-app', function (Y) {
YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {
"json-stringify":{"requires":["yui-base"]},
"foo":{
[
{
"settings": [ "master" ],
"appPort": 80,
"staticHandling": {
"cache": true
},
"yui": {
"config": {
"combine": true,
@caridy
caridy / test.js
Created November 20, 2012 17:44
YUI.JSON.* vs JSON.* in Node.JS
var Y = require('yui/json'),
microtime = require('microtime'),
i,
t,
obj = {
foo: {
bar: {
baz: 'token'
}
}
@caridy
caridy / perf.js
Created November 20, 2012 23:07
Perf optimization for function hooks in Node.JS
var microtime = require('microtime'),
i,
t,
obj,
max = 10000000;
function run1(obj) {
t = microtime.now();
for (i = 0; i < max; i += 1) {
if (obj.foo) obj.foo();
@caridy
caridy / results.txt
Created November 21, 2012 17:03
Compare set to null vs delete member in NodeJS
NodeJS 0.8.x on MBP:
$ node delete.js
89300 'value to null'
3100674 'deleting member'
@caridy
caridy / modified.js
Created December 5, 2012 02:06
headers modified tests for static handling
function modified(req, headers) {
var modifiedSince = req.headers['if-modified-since'],
lastModified = headers['Last-Modified'],
noneMatch = req.headers['if-none-match'],
etag = headers.ETag,
etagModified = true,
dateModified = true;
// Check If-None-Match
if (noneMatch && etag && noneMatch === etag) {
etagModified = false;
@caridy
caridy / base-benchmark.js
Created December 10, 2012 19:24
Benchmark and Benchtable in Mojito
YUI.add('base-benchmark', function (Y) {
var suite = Y.BenchmarkSuite;
var MyBase20 = function() {
MyBase20.superclass.constructor.apply(this, arguments);
};
Y.extend(MyBase20, Y.Base);
@caridy
caridy / README.md
Created December 10, 2012 19:45
Mojito 0.5.0 preliminar doc on YUI Seed

Mojito Seed files

In a regular YUI App, the seed file is just the YUI Seed file, and by including it in your pages in a form of a script tag you are ready to use YUI, e.g.:

<script src="http://yui.yahooapis.com/3.7.3/build/yui/yui-min.js"></script>

From that url, the library can infer few things like the version of the library that should be used, the filter that you want to use (min, debug or raw), the CDN that is serving the library, etc. But when it comes to a mojito application, things are a little bit different, since the YUI library is bundle with the application using npm, and the way your application runs might also disrupt from a regular web application when it comes to mobile. On top of that, the introduction of a lot of new YUI modules, part of the mojito code, and part of the app code that should work in the same way that YUI Core modules work through the loader, all that makes it difficult to use the standard way for the seed in a mojito application.