Skip to content

Instantly share code, notes, and snippets.

View tcelestino's full-sized avatar

Tiago Celestino tcelestino

View GitHub Profile
@tcelestino
tcelestino / metas.md
Last active February 22, 2022 15:50
meta tags

#Meta Tags

<!---favicon-->
<link rel="icon" href="http://www.example.com/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="http://www.example.com/favicon.ico" type="image/x-icon">

<!--Apple Touch Icon for iPad and iPhone Meta Tag-->
<link rel="apple-touch-icon" href="http://www.example.com/apple-touch-icon.png">
<link rel="apple-touch-icon-precomposed" href="http://www.example.com/apple-touch-icon.png">
@tcelestino
tcelestino / generator.php
Created July 19, 2013 21:49
Generator image with text in PHP
<?php
// Defini o caminho da imagem sabe
$img = card.jpg;
// Cria um jpg com base na imagem base, essa será a nova imagem
$i = imagecreatefromjpeg($img);
// Definições do texto
$texto = "Aqui o texto que será escrito na imagem";
@tcelestino
tcelestino / title.php
Created August 12, 2013 00:38
the best title wordpress
<?php if (is_home () ) {
bloginfo('name');
} elseif ( is_category() ) {
single_cat_title(); echo ' - ' ; bloginfo('name');
} elseif (is_single() ) {
single_post_title();
} elseif (is_page() ) {
bloginfo('name'); echo ': '; single_post_title();
} else {
wp_title('',true);
@tcelestino
tcelestino / flash_js
Created October 7, 2013 19:31
Flash lendo uma função JS
import flash.external.ExternalInterface;
ExternalInterface.addCallback("javascriptFNC", flashFNC);
function flashFNC():void{
//actions
}
----------------------------------------------------------
## javascript
@tcelestino
tcelestino / mysql_apache_php_install.sh
Last active December 26, 2015 10:19
install mysql, apache and php on linux
#INSTALLING MYSQL
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install mysql-server mysql-client
#optional
sudo mysqladmin -u root -h localhost password 'mypassword'
sudo mysqladmin -u root -h myhostname password 'mypassword'
#install php library
@tcelestino
tcelestino / gist:7136513
Last active December 26, 2015 10:28
using mysql terminal
mysql -u root -p #init mysql
create database dbname; #create database
use dbname; #use database
source pathofsqlfile.sql #import dump sql
@tcelestino
tcelestino / change-db.sql
Last active January 12, 2018 04:20
wordpress snippets
/* update table wp_post_meta */
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '/wp/', '/') WHERE 1=1;
/* update table wp_post */
UPDATE wp_posts SET post_content = REPLACE(post_content, '/wp/', '/') WHERE 1=1
UPDATE wp_posts SET guid = REPLACE(guid, '/wp/', '/') WHERE 1=1
@tcelestino
tcelestino / .bash_profile
Last active August 22, 2016 23:02
my bashrc profile
# ENVIRONMENT
#export JAVA_HOME=~/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
export ANT_HOME=/Users/$USER/Development/apache-ant-1.8.2
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
export JBOSS_HOME=/Users/$USER/Development/jboss-5.1.0.GA
export JETTY_HOME=/Users/$USER/Development/jetty-6.1.3
export JRUBY_HOME=/Library/Frameworks/JRuby.framework/Versions/Current
export M2_HOME=/Users/$USER/Development/apache-maven-3.0.3
export MACPORTS=/opt/local/bin:/opt/local/sbin
export MONGO_HOME=/usr/local/mongodb
@tcelestino
tcelestino / mixins.scss
Last active December 28, 2015 05:09
my custom mixins SASS
// return width - padding
@function calc-width($width, $padding) {
@return $width - $padding
}
// return height - padding
@function calc-height($height, $padding) {
@return $height - $padding
}
@tcelestino
tcelestino / blank_window.js
Created November 28, 2013 17:30
open all links in page with target="_blank" in a new window
window.onload = function() {
var links = document.getElementsByTagName('a'), len = links.length;
for(var i = 0; i < len; i++) {
links[i].addEventListener('click', function(event) {
if (this.target === '_blank') {
window.open(this.url, '_blank');
}