Skip to content

Instantly share code, notes, and snippets.

View Satyam's full-sized avatar

Daniel Barreiro Satyam

  • Sitges, Barcelona, Spain
View GitHub Profile
@Satyam
Satyam / gist:3934292
Created October 22, 2012 21:05
Views loading separate templates
YUI.add('sampleView',function(Y, NAME) {
Y.SampleView = Y.Base.create(NAME, Y.View, [], {
initializer:function(){
var self = this;
self.parallel = new Y.Parallel();
Y.io('templates/' + NAME + '.html',{
on:{
complete: self.parallel.add(function(id,response){
console.log('io completed');
self.template = response.responseText;
@Satyam
Satyam / gist:3595837
Created September 2, 2012 08:20
TreeView Speed test
YUI(
{gallery: 'gallery-2012.08.29-20-10'}
).use('gallery-yui3treeview-ng', function (Y) {
'use strict';
var count = 0,
makeBranch = function (prefix, depth) {
var branch = [], node;
count +=1;
for (var i = 0; i < 5; i+=1) {
@Satyam
Satyam / gist:2989480
Created June 25, 2012 16:04
Person.js (view)
YUI.add('personView',function(Y, NAME){
var TEMPLATES = {},
COMPILED_TEMPLATES = {};
Y.Object.each(TEMPLATES, function (template, name) {
COMPILED_TEMPLATES[name] = Y.Handlebars.compile(template);
});
Y.PersonView = Y.Base.create(
NAME,
Y.View,
[],
@Satyam
Satyam / gist:2989468
Created June 25, 2012 16:02
template server
var express = require('express'),
fs = require('fs'),
path = require('path'),
server = express.createServer(),
rexpTEMPLATE = /TEMPLATES\s*=\s*\{\s*\}/,
rexpJs = /\.js$/i,
rexpHtml = /\.html$/i,
VIEWS = '/scripts/views/',
MODELS = '/scripts/models/';
@Satyam
Satyam / gist:2988409
Created June 25, 2012 12:52
Person.View.js
YUI.add('personView',function(Y){
Y.PersonView = Y.Base.create(
'personView',
Y.View,
[],
{
initializer:function(){
this.model = this.get('model');
},
render:function(){
@Satyam
Satyam / gist:2828156
Created May 29, 2012 12:30
ac.done usage example
model.read(idPersona, function(err, rows) {
if (err) {
ac.error(err);
return;
}
ac.done({
debug:Y.JSON.stringify(rows),
persona:rows
}, {params:{route: {idDireccion:rows[0].idDireccion}}});
@Satyam
Satyam / gist:2828145
Created May 29, 2012 12:28
ac.done patch
ac.done = (function (original) {
return function (data, opts) {
opts = opts || {};
var instance = ac.command.instance,
config = instance.config || {},
action = instance.action,
children = config.children,
params = ac.params.getAll(),
me = this,
childOpts = opts.children || {};
@Satyam
Satyam / gist:2601422
Created May 5, 2012 10:36
TreeView Editor patch
(function () {
var TV = YAHOO.widget.TreeView,
TVProt = TV.prototype,
Event = YAHOO.util.Event,
Dom = YAHOO.util.Dom;
TVProt.draw = TVProt.render = function () {
var html = this.root.getHtml(),
el = this.getEl(),
ed = TV.editorData;
@Satyam
Satyam / Y.Button
Created March 15, 2012 14:32
My Y.Button plugin proposal, without modifying Attribute
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Button test</title>
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.0pr1/build/yui/yui.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.5.0pr1/build/cssreset/reset-min.css&3.5.0pr1/build/cssfonts/fonts-min.css&3.5.0pr1/build/cssbase/base-min.css&3.5.0pr1/build/cssgrids/grids-min.css" />
<link rel="stylesheet" type="text/css" href="cssbutton.css" />
</head>
@Satyam
Satyam / gist:1605872
Created January 13, 2012 12:28
My Y.Button proposal
<!DOCTYPE html>
<html>
<head>
<!-- Better yet, see: https://gist.github.com/2044488 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Button test</title>
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.0pr1/build/yui/yui.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?3.5.0pr1/build/cssreset/reset-min.css&3.5.0pr1/build/cssfonts/fonts-min.css&3.5.0pr1/build/cssbase/base-min.css&3.5.0pr1/build/cssgrids/grids-min.css" />