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 / old-html-markup.html
Created October 15, 2012 17:08
Old HTML markup for my blog post
<div id="header">
<!-- Algum conteúdo -->
</div>
<div id="menu">
<!-- Links do menu -->
</div>
<div id="content">
<!-- Conteúdo da página -->
</div>
<div id="footer">
@ejulio
ejulio / html5-markup.html
Created October 15, 2012 17:58
The HTML5 markup for my blog post
<header>
<!-- Algum conteúdo -->
</header>
<nav>
<!-- Links do menu -->
</nav>
<div role="main">
<!-- Conteúdo da página -->
<!-- O uso da tag div com um atributo role, foi escolhido pois neste caso é entendido apenas como um container -->
</div>
@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));
@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 / 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 / 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 / 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 / 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 / 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 / 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)
{