Skip to content

Instantly share code, notes, and snippets.

View glauberramos's full-sized avatar

Glauber Ramos glauberramos

View GitHub Profile
@glauberramos
glauberramos / gist:3641107
Created September 5, 2012 17:48
Javascript Closure Example
var a = function() {
var b = 0;
return function() {
b = b + 1;
return b;
};
};
var d = a();
@glauberramos
glauberramos / FrontCalendar 2012.md
Created August 21, 2012 17:33 — forked from zenorocha/FrontCalendar.md
FrontCalendar 2012

FrontCalendar 2012

Na falta de um site decente e realmente atualizado com os eventos de front-end que vão rolar, dê um pulo aqui ;)

Vai rolar!

Tableless Conference

  • Quando: 24/08
  • Onde: São Paulo, SP
  • Preço: R$ 250,00
@glauberramos
glauberramos / bad.js
Created July 19, 2012 03:17
Bad javascript code - Example for blog post - Remove Unuseful Code
function book(name, author, content, date) {
var name = name,
author = author,
content = content,
date = date;
var self = {
containsWord: function(word) {
return content.indexOf(word) >= 0;
},
@glauberramos
glauberramos / bad.js
Created July 19, 2012 03:03
Bad javascript code - Example for blog post - DRY
function book(name, author, content, date) {
var name = name;
var author = author;
var content = content;
var date = date;
var self = {
containsWord: function(word) {
return content.indexOf(word) >= 0;
},
@glauberramos
glauberramos / bad.js
Created July 19, 2012 02:44
Bad javascript code - Example for blog post - White Spaces
function book(name, author, content, date) {
var name = name;
var author = author;
var content = content;
var date = date;
var self = {
findWord: function(word) {
return content.indexOf(word) >= 0;
},
@glauberramos
glauberramos / bad.js
Created July 19, 2012 02:41
Bad javascript code - Example for blog post - Concise Comments
function book(name,author,content,date) {
var name = name;
var author = author;
var content = content;
var date = date;
var self = {
findWord: function(word) {
return content.indexOf(word)>=0;
},
@glauberramos
glauberramos / bad.js
Created July 19, 2012 02:37
Bad javascript code - Example for blog post - Meanful and Concise Variables/Methods Names
//this function represents a book from an online library
//it has 3 methods to search the book, remove a specific word and change it
//it has 4 attributes, name, author, date and content
//creates libaries stuffz
function book(name,author,content,date) {
var name = name;
var author = author;
var content = content;
var date = date;
@glauberramos
glauberramos / bad.js
Created July 19, 2012 02:33
Bad javascript code - Example for blog post - Identation
//this function represents a book from an online library
//it has 3 methods to search the book, remove a specific word and change it
//it has 4 attributes, name, author, date and content
//creates libaries stuffz
function elementliBRaryContent(a,b,c,d) {
var bnam = a;
var baut = b;
var bdat = c;
var bcont = d;
@glauberramos
glauberramos / bad.js
Created July 11, 2012 02:24
Bad javascript code - Example for blog post
//this function represents a book from an online library
//it has 3 methods to search the book, remove a specific word and change it
//it has 4 attributes, name, author, date and content
//creates libaries stuffz
function elementliBRaryContent(a,b,c,d) {
var bnam = a;var baut = b;
var bdat = c;
var bcont = d;
var self = { findword: function(x) { return bcont.indexOf(x)>=0;},
@glauberramos
glauberramos / doors.js
Created May 30, 2012 14:34
3 Doors (One with a reward) problem
var doors = [false, false ,true];
var didntChangeDoorCount = 0;
var changedDoorCount = 0;
for(i=0;i<10000;i++) {
var picker = Math.floor(Math.random()*3);
//dont change
if(doors[picker]) didntChangeDoorCount++;