Skip to content

Instantly share code, notes, and snippets.

View lillyfreitas's full-sized avatar

LFreitas lillyfreitas

View GitHub Profile
@lillyfreitas
lillyfreitas / custom-error-msgs
Last active May 26, 2020 02:41 — forked from zergiocosta/custom_error_msgs.php
Mensagens de erro de login (wp-admin)
<?php
/*
*
* Plugin Name: Mensagens de erro de login
* Description: Mensagens aleatórios e personalizadas para tentativas fracassadas de login.
* Version: 1.1
* Author: LFreitas based on Sergio Costa (zergiocosta)
* Text Domain: custom-error-msgs
*
* source: https://gist.github.com/zergiocosta/72f87176b236ed0c6e13
@lillyfreitas
lillyfreitas / header.php
Last active May 19, 2018 00:06
Adicionar manualmente tags Open Graph em tema do WordPress
<!-- Compartilhamento em redes sociais -->
<!-- OPEN GRAPH -->
<?php
$img_compartilhe = get_post_meta($post->ID,'_thumbnail_id',false);
$img_compartilhe = wp_get_attachment_image_src($img_compartilhe[0], false);
$img_compartilhe = $img_compartilhe[0];
$img_padrao = get_bloginfo('stylesheet_directory').'/SUAIMAGEM.jpg';
// Recupera a URL da categoria
$the_cat = get_the_category();
@lillyfreitas
lillyfreitas / tamanho-pasta.sh
Created November 4, 2017 22:55
Estimar tamanho ocupado por uma pasta
# Fonte: https://unix.stackexchange.com/a/185765
# du
# comando para estimar o espaço usado
# -s
# exibe apenas um total para cada argumento
# -h
# formato amigável (ex: 1K, 234M, 2G)
# -c
# total de mais de uma pasta/subpastas
@lillyfreitas
lillyfreitas / static-google-map-api.md
Last active May 19, 2018 00:06
Mapa estático do Google - Google Maps API
@lillyfreitas
lillyfreitas / social-media-and-whatsapp-share.md
Last active May 19, 2018 00:06
Adicionar compartilhamento em redes sociais (Facebook, Twitter, Google+ e LinkedIn) e WhatsApp + configurar apresentação (Open Graph)

WhatsApp

Basta fazer um link com para whatsapp://send?text=TITULO &ndash; LINK, exemplo:

<a href="whatsapp://send?text=TITULO &ndash; LINK" title="Acesse de seu smartphone para enviar por WhatsApp">WhatsApp</a>
  • TITULO da página
  • LINK para a página
@lillyfreitas
lillyfreitas / centralizar-vertical-horizontal.css
Last active May 19, 2018 00:06
Centralizar div vertical e horizontalmente
/* Centralizar vertical e horizontal. Fonte: https://www.w3.org/Style/Examples/007/center.en.html#viewport3 */
div.aviso {
background:#006600;
color:#FFFFFF;
border-radius:10px;
padding:10px;
position:absolute;
top:50%;
left:50%;
margin-right: -50%;
@lillyfreitas
lillyfreitas / multi-parte-tar.sh
Last active May 19, 2018 00:06
Como criar um tar multipart
# Fonte: http://dicas.obiz.com.br/artigo/como-criar-um-tar-multipart
# Fragmentar um tar muito grande pode ser muito útil para transferir arquivos com conexões caindo:
tar -cvf - meuarquivo.grande | split -b 10m - meuarquivo.tar
# Para juntar tudo e descompactar, use o comando seguinte:
cat meuarquivo.tar.* | tar xvf -
@lillyfreitas
lillyfreitas / alinhar-2a-linha-listas.css
Last active May 19, 2018 00:05
Alinhar segunda linha de listas HTML com CSS
/*
* Os valores têm de ser iguais.
* Fonte: http://jsfiddle.net/j7MEd/234/
*/
ul li,
ol li {
text-indent: -15px;
margin-left: 15px;
}
@lillyfreitas
lillyfreitas / redirect.php
Created February 7, 2017 00:21
Redirecionar páginas (HTML, JavaScript e PHP)
<!-- HTML -->
<meta http-equiv="refresh" content="0;url=http://url-de-destino.com/">
<!-- JavaScript -->
<script language="javascript">
window.location='http://url-de-destino.com/';
</script>
<!-- PHP -->
<?php header('Location: http://url-de-destino.com/'); ?>