Skip to content

Instantly share code, notes, and snippets.

View rodrigo-x's full-sized avatar
👻

Rodrigo_ rodrigo-x

👻
View GitHub Profile
@rodrigo-x
rodrigo-x / gist:3890240
Created October 15, 2012 00:12
snippet - colocar * no input...
$(function(){
$.input = function(elem){
$(elem)
.val("*")
.keyup(function(){
self = $(this);
inputValue = self.val();
charPos = inputValue.indexOf("*");
@rodrigo-x
rodrigo-x / gist:3890244
Created October 15, 2012 00:15
snippet - teste de plugin..
;(function($){
Class = function(elem){
this.elem = elem;
this.$elem = $(elem);
};
Class.prototype = {
init: function(){
this.efeito();
this.cachorrada();
@rodrigo-x
rodrigo-x / gist:3890247
Created October 15, 2012 00:16
snippet - teste plugin jquery...
;(function($){
Class = {
init: function(){
this.each(function(){
var $this = $(this);
$this.click(function(){
$this.css('background-color', 'red');
alert('oi')
})
});
@rodrigo-x
rodrigo-x / gist:3890249
Created October 15, 2012 00:17
snippet - load no ext...
Ext = {}
Ext.load = function(opt){
try{
self = $(opt);
self.click(function(){
self.addClass('feio');
alert('oi');
});
}catch(e){
@rodrigo-x
rodrigo-x / gist:3890256
Created October 15, 2012 00:20
snippet - search no facebook com jQuery..
/*!
* jQuery JavaScript Library v1.7.1
* http://jquery.com/
*
* Copyright 2012, Rodrigo Nery
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Copyright 2012, Rodrigo Nery
* Released under the MIT, BSD, and GPL Licenses.
@rodrigo-x
rodrigo-x / gist:3890265
Created October 15, 2012 00:23
snippet - teste...
var Pessoa = (function(){
var nome = 'John Smith';
var idade = 30;
var updatePessoa = function(){
nome = 'John Smith Updated';
}
var setPessoa = function(){
@rodrigo-x
rodrigo-x / gist:3890266
Created October 15, 2012 00:24
snippet - add input...
$(function(){
$.options = (function(){
var $self = $(this);
if ($self.val() === "add"){
var $select = $self.closest("select");
$select.hide();
var $input = $("<input>").blur(function(){
var $self = $(this);
var newVal = $.trim($self.val());
if (newVal.length > 11) alert("Grande demais!");
@rodrigo-x
rodrigo-x / gist:3890269
Created October 15, 2012 00:25
snippet - facade..
var Class = (function(){
var _private = {
i: 0,
get: function(){
console.log('current value:' + this.i);
},
set: function(val){
this.i = val;
@rodrigo-x
rodrigo-x / gist:3890270
Created October 15, 2012 00:25
snippet - hash na url...
(function (win) {
win.hashchange(function () {
var page = location.hash + '_c';
var $self = $(page);
if (page == '_c') {
page = '#home_c';
}
@rodrigo-x
rodrigo-x / gist:3890271
Created October 15, 2012 00:26
snippet - conceito...
var Pessoa = Pessoa || {};
(function (o) {
o.setName = function (val) {
this.name = val;
};
o.setAge = function (val) {
this.Age = val;
}