Skip to content

Instantly share code, notes, and snippets.

View tcelestino's full-sized avatar

Tiago Celestino tcelestino

View GitHub Profile
@tcelestino
tcelestino / custom-css.css
Last active December 16, 2015 00:29
custom stylesheets example
/* image replacement
Scott Kellum
*/
.ir {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@tcelestino
tcelestino / gist:5490336
Created April 30, 2013 17:29
Add value customize input (metabox) when upload files on WordPress. This functions is based in solution posted on stackoverflow: http://stackoverflow.com/a/5671763/1156665
/*
save file upload customize input wordpress
@return void
*/
function saveFileUpload(button, input) {
var uploadID = '';
jQuery(button).click(function() {
uploadID = jQuery(this).prev('input');
formfield = jQuery(input).attr('name');
@tcelestino
tcelestino / facebook_comment.js
Last active November 8, 2017 18:27
Salvando comentário do Facebook em um post no sistema de comentários do WordPress.
// esse script terá que ficar no header.php
window.fbAsyncInit = function() {
FB.init({
appId : 'app id',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
function validaCPF(cpf)
{
var numeros, digitos, soma, i, resultado, digitos_iguais;
digitos_iguais = 1;
if (cpf.length < 11)
return false;
for (i = 0; i < cpf.length - 1; i++)
if (cpf.charAt(i) != cpf.charAt(i + 1))
{
digitos_iguais = 0;
@tcelestino
tcelestino / Package-Control.json
Last active October 15, 2017 22:31
My preference Sublime Text IDE
{
"in_process_packages":
[
],
"installed_packages":
[
"Aurora Color Scheme",
"EditorConfig",
"Emmet",
"Git",
@tcelestino
tcelestino / estados_cidades.sql
Created June 6, 2013 19:02
Cidades e estados brasileiros
CREATE TABLE IF NOT EXISTS `pais` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(60) DEFAULT NULL,
`sigla` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `pais` (`id`, `nome`, `sigla`) VALUES (1, 'Brasil', 'BR');
@tcelestino
tcelestino / show_menu.js
Created June 20, 2013 14:16
Show menu item with id element
function showlayer(layer){
var myLayer=document.getElementById(layer);
if(myLayer.style.display=="none" || myLayer.style.display==""){
myLayer.style.display="block";
} else {
myLayer.style.display="none";
}
}
@tcelestino
tcelestino / gist:5881739
Last active March 21, 2016 15:01
Building structure page with Emmet.io plugin.
!>header.top>(div.logo>h1>a[href=#].ir{Nome do site})+(nav.menu-top>ul.menu>li*9>a[href=#])^section.slides>a[href=#].ir.control-slide.control-prev+ul>li+a[href=#].ir.control-slide.control-next^^div.wrap>div.container>(div.col1>section.news>span.title.title-section{Titulo da seção}+div.box.box-section>ul>li*7>a[href=#])+(div.col2>section.types-box>div.box.box-article>article.post*3>div.thumbnail.thumbnail-180_126>img[src=http://placehold.it/180x126]^div.hat+p.text>a[href=#]^a.button.button_01[href=#]{Saiba mais +})+(aside.sidebar>section.box.box-sidebar>div.special_01>figure.img-ads+span.title-special{Nome do especial})^^footer.foot>div.container>(div.extra>address)+ul.social>li*2>a[href=#]
@tcelestino
tcelestino / index.html
Created July 6, 2013 20:36
Validate forms data with jQuery without plugin
<!doctype html>
<html lang="pt_BR">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<title>Validate form with jQuery</title>
</head>
<body>
<form action="" method="post" id="formExample">
<fieldset>