Skip to content

Instantly share code, notes, and snippets.

View ejulio's full-sized avatar
🏠
Working from home

Júlio César Batista ejulio

🏠
Working from home
View GitHub Profile
@ejulio
ejulio / GroupinBuilder_GridBuilder.js
Last active December 10, 2015 15:58
Using the Builder pattern to create a Grid and a Grouping
Ext.define('GroupingBuilder', {
defaultCfg: {
ftype: 'grouping'
},
build: function(grouping)
{
grouping = Ext.isObject(grouping) ? grouping : {};
Ext.applyIf(grouping, this.defaultCfg);
@ejulio
ejulio / GridBuilder.js
Created January 4, 2013 21:53
Builder pattern applied to the Grid class
Ext.define('GridBuilder', {
grouping: false,
build: function()
{
var gridCfg = {
xtype: 'grid',
features: []
};
@ejulio
ejulio / Grid.js
Created January 4, 2013 21:51
An example of a Grid
Ext.define('Grid', {
extend: 'Ext.grid.Panel',
grouping: false,
constructor: function(cfg)
{
if (cfg.grouping)
{
@ejulio
ejulio / good_js.js
Created October 31, 2012 12:36
good javascript code
// função após o hositing
function fazerAlgumaCoisa()
{
var x;
window.x = 10;
if (window.x > 9)
{
for(x = 5; x > 1; x--)
{
console.log(x); // 5 - 2
@ejulio
ejulio / fn_original.js
Created October 31, 2012 12:33
javascript's hoisting error example
// função original
function fazerAlgumaCoisa()
{
x = 10;
if (x > 9)
{
for(var x = 5; x > 1; x--) // 5 - 2
{
console.log(x);
}
@ejulio
ejulio / hoisting.js
Created October 31, 2012 12:19
A javascript's hoisting example
// função original
function teste()
{
if(foo())
{
var bar = 10;
}
function foo()
{
return true;
@ejulio
ejulio / for_csharp.cs
Created October 31, 2012 12:14
for statement in javascript, C# and Java
void teste()
{
for(int i = 0; i < 10; i++)
{
Console.WriteLine(i); // 1 - 9
}
Console.writeLine(i); // erro
}
@ejulio
ejulio / undefined.js
Created October 23, 2012 11:39
Undefined value x Undefined property
var myvar; // local variable, value = undefined
window.undefined; // global property, value = undefined
if (myvar === undefined) // comparando myvar com a propriedade global (undefined === undefined)
{
// algum código que será executado
}
window.undefined = 123; // global property, value = 123
@ejulio
ejulio / closure_isUndefined.js
Created October 23, 2012 11:26
Alternative to function isUndefined
(function(undefined)
{
function isUndefined(value)
{
return value === undefined;
}
window.undefined = 123;
var x;
console.log(isUndefined(x));
console.log(isUndefined(123));
@ejulio
ejulio / isUndefined.js
Created October 22, 2012 16:56
An example showing the undefined javascript's global property
function isUndefined(value)
{
return value === undefined;
}
window.undefined = 123;
var x;
console.log(isUndefined(x));
console.log(isUndefined(123));