Skip to content

Instantly share code, notes, and snippets.

View tcelestino's full-sized avatar

Tiago Celestino tcelestino

View GitHub Profile
@tcelestino
tcelestino / .zshrc
Last active October 18, 2018 13:53
my settings to oh-my-zsh
# Path to your oh-my-zsh installation.
export ZSH=/Users/tcelestino/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="honukai"
# Uncomment the following line to use case-sensitive completion.
@tcelestino
tcelestino / truncate.js
Created October 15, 2014 17:22
truncate string
/**
* truncate title
* @param {String} text suffix
* @param {Number} size text
* @return {String} text truncate
*/
var truncateText = function(str, size, suffix) {
var newTitle;
function valida(selector, show_errors) {
var show_errors = (show_errors!=undefined)?show_errors:true;
var validaForm = true;
/*var $input = $("input[type=email]").val();
var _reg = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if(!_reg.test($input)) {
alert("digite um email válido");
@tcelestino
tcelestino / jquery.browser.js
Created April 7, 2014 21:17
jquery browser
(function( jQuery ) {
var matched,
userAgent = navigator.userAgent || "";
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
@tcelestino
tcelestino / git-snippets.md
Last active July 26, 2019 17:56
git snippets

Git Snippets

BRANCH

git clone -b <branchName> <urlRepo> #faz o clone de um  branch especifico.
git branch -D <branchName> #deletar branch local
git push origin --delete <branchName> #atualiza repo com a remoção da branch
git branch -m <oldName> <newName> #renomeia uma branch
git push --set-upstream origin <branchName> #faz push da branch local para o repo
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@tcelestino
tcelestino / gmail-snippet.txt
Created March 5, 2014 13:31
gmail snippets
l:^g – Para encontrar conversas que foram interrompidas.
l:^p – Mensagens marcadas como phishing.
l:^op – As marcadas como phishing de forma automática pelo Gmail
l:^os – As marcadas de forma automática como spam
l:^vm – As mensagens de voz de Google Voice voicemail
l:^io_im – As mensagens importantes
l:^unsub – As que incluem opção para cancelar assinatura
l:^cff – Os e-mails de nossos contatos do Google+
l:^p_esnotif – As notificações de Google+
@tcelestino
tcelestino / wp-mail-fork.php
Created January 9, 2014 09:13
WP-Mail plugin modify
<?php
/**
* Plugin Name: WP-EMail
* Plugin URI: http://lesterchan.net/portfolio/programming/php/
* Description: Allows people to recommand/send your WordPress blog's post/page to a friend.
* Version: 2.52
* Author: Lester 'GaMerZ' Chan
* Author URI: http://lesterchan.net
*/
/*
<?php
ob_start();
if(!function_exists("do_action")) :
header('content-type: text/xml');
include_once('../../../../wp-config.php');
endif;
$xml = array();
$xml[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
$xml[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
$xml[] = "<lista>";
@tcelestino
tcelestino / handlebras-helpers.js
Last active December 31, 2015 23:48
Handlebars Helpers
// console
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
console.log(this);
if (optionalValue) {
console.log("Value");
console.log("====================");
console.log(optionalValue);