Skip to content

Instantly share code, notes, and snippets.

View kaiquewdev's full-sized avatar

Kaique Silva kaiquewdev

View GitHub Profile
@kaiquewdev
kaiquewdev / abas.js
Created June 28, 2011 03:11
Controle de abas
/*
nomeMenu = "Menu que sera selecionado",
item = "Item do menu que sera selecionado",
conteudo = "conteudo do menu que sera selecionado"
Teste URL: http://jsbin.com/ecitid/4
*/
function alternarAbas(nomeMenu,item,conteudo){
var mElement = $(nomeMenu+" "+item);
$(conteudo).css({display:"none"});
$(conteudo+":eq(0)").css({display:"block"});
@kaiquewdev
kaiquewdev / alternate
Created July 7, 2011 20:35
Selecionar objetos
/*Alternar opções*/
function alternarOpt(menu, itens){
/*Esconde os itens*/
$(itens).css({visibility:"hidden"});
$(menu).bind('click', function(){
var item = $(menu).index(this);
var vItem = $(menu+':eq('+item+')').attr("value");
$(menuItem+' a').attr({target:'_top'});
var urlAct = $(menuItem+classAct+' a').attr('href');
$(frame).load(urlAct);
$(menuItem).bind('click',function(){
var url = $(this).find('a').attr('href');
var indice = $(menuItem+' a').index(this);
$(this).find('a').attr({href:" "});
$(frame).load(url,function(){
$(menuItem+' a:eq('+indice+')').attr({href:'#'+url});
#!/usr/bin/python
#pega a entrada do usuario
n = raw_input('Digite o valor: ')
def fatorar(v):
if v:
try:
v = int(v)
except ValueError:
v = 0
@kaiquewdev
kaiquewdev / gist:1108556
Created July 27, 2011 02:52
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@kaiquewdev
kaiquewdev / vimrc
Created September 25, 2011 07:06
my_vimrc
syntax on " Syntax color
set number " Numeration line by line
colorscheme torte " Set a desert scheme to default
" Search color
hi Search cterm=none ctermbg=4 ctermfg=15
set hlsearch
" History
set history=700
" Autoread
set autoread
@kaiquewdev
kaiquewdev / LICENSE.txt
Created September 29, 2011 13:41 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#! /usr/bin/env python
# -*- coding: utf8 -*-
class Naturals(object):
def __init__(self, n):
self.n = n
def sum_square(self):
for i in range(self.n):
i = i**2
@kaiquewdev
kaiquewdev / gist:1662621
Created January 23, 2012 11:25 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
var Event = function Event() {
var _target;
this.setTarget = function setTarget( value ) {
value = value || '';
if ( value ) {
_target = value;
}
}