Skip to content

Instantly share code, notes, and snippets.

View tcelestino's full-sized avatar
⛱️
Working from home

Tiago Celestino tcelestino

⛱️
Working from home
View GitHub Profile
@tcelestino
tcelestino / gist:4118430
Created November 20, 2012 15:00
counter limit textarea
// limitador de caracteres
var limitText = function() {
var count = 600; // value limit caracter
var txt = document.forms[0].text.value;
var len = txt.length;
var countText = document.getElementById("your-counter"); // create element your html
if(len > count){
txt = txt.substring(0,count);
document.forms[0].text.value = txt;
return false;
@tcelestino
tcelestino / README.md
Last active March 25, 2018 11:44 — forked from zenorocha/README.md
Versão em pt-br

Nome do Projeto

Descreva o projeto.

Instalação

Descreva o processo de instalação

Como usar

@tcelestino
tcelestino / google_maps.css
Last active December 11, 2015 20:48
How to fix bug Google Maps controls and infowindow.
#maps {
width: 100%;
height: 100%;
}
// this is solution
#maps img {
max-width: inherit;
}
@tcelestino
tcelestino / gist:4959890
Last active December 13, 2015 19:08
Remove item for array - by Andrey Knupp (https://github.com/andreyknupp)
Array.prototype.remove = function(i) {
var index;
if( ( index = this.indexOf( i ) ) !== -1 ) {
this.splice( index , 1 );
}
return this
};
@tcelestino
tcelestino / gist:5052527
Created February 27, 2013 22:41
Animate scrollTop using jQuery.
function scrollUp() {
var content_animate = $(jQuery.browser.webkit ? "body": "html"); // bug fix to animate on firefox and uses to opera and ie.
var _position = content_animate.scrollTop();
if(_position > 0) {
content_animate.animate({
scrollTop: 0
}, 1500);
}
}
@tcelestino
tcelestino / README.md
Last active December 14, 2015 16:59
show metabox in wordpress save data

Criando um metabox no WordPress

Um exemplo de como criar um metabox para upload no WordPress

@tcelestino
tcelestino / README.md
Last active October 8, 2020 22:49
Gallery photos with jQuery (no plugin)

Gallery Photo with jQuery

Example gallery photos using jQuery (without plugin).

*This a experiment for learn jQuery basic

@tcelestino
tcelestino / shorten.php
Created March 8, 2013 19:34
shorten url using bit.ly api
<?php
//função do curl baseado no script do David Walsh (http://davidwalsh.name/)
function curl_get_result($url) {
$ch = curl_init($url);
$timeout = 50;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
@tcelestino
tcelestino / README.md
Last active October 8, 2020 22:48
Gallery YouTube videos using PHP and jQuery

Gallery YouTube Videos

Example with usage api YouTube with jQuery and PHP.

@tcelestino
tcelestino / add-post-with-upload-images-front.php
Last active December 15, 2015 23:49
Criação de um post no WordPress no front-end com upload de imagem.
<?php
// adiciona o post ao WordPress
add_action('wp_ajax_nopriv_post_insert', 'post_insert');
add_action('wp_ajax_post_insert', 'post_insert');
function post_insert(){
require_once(ABSPATH . 'wp-admin/includes/image.php');
if('POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {