BitBonsai Labs Mauricio Wolff's geekness

29Jun/100

Testing pastie.org embed

27Apr/100

JS Tip: Revealing Module Pattern

From Christian Heilmann. Nothing too fancy for those who are used to write jQ plugins, but nice to save it for reference...

var myApp = function(){
	var nome = 'Mauricio Wolff';
	var idade = 35;
 
	function insertPessoa(){
		// [...]
	}
 
	function updatePessoa(){
		// [...]
	}
 
	function setPessoa () {
		// [ usa insert ou update ]
	}
 
	function getPessoa () {
		// [...]
	}
 
	return{
		set: setPessoa,
		get: getPessoa
	}
}();
 
// Example usage:
myApp.get();
16Jan/100

Porque adoro jQuery

Pedido: Fazer com que todos os links de uma determinada página sejam externos.

  • Abordagem 1: Alterar a classe em php, genérica, para ver se o link é externo e acrescentar o target; por regex.
  • Abordagem 2: Colocar no init.js
$("a[href^='http://']").attr("target","_blank");

E todo site fica assim; links externos, para fora!
Aff... que doce.