Skip to content

Instantly share code, notes, and snippets.

View claudiosanches's full-sized avatar
👨‍💻

Claudio Sanches claudiosanches

👨‍💻
View GitHub Profile
@claudiosanches
claudiosanches / bomfinder.php
Last active November 24, 2015 18:20
UTF8 BOM finder
<?php
// Tell me the root folder path.
// You can also try this one
// $home = $_SERVER['DOCUMENT_ROOT'];
// Or this
// dirname( __FILE__ )
$home = dirname( __FILE__ );
// Is this a Windows host ? If it is, change this line to $windows = true;
$windows = false;
@claudiosanches
claudiosanches / rand_banners.html
Created April 12, 2012 16:30
Função para banners randômicos
<!DOCTYPE html>
<html dir="ltr" lang="pt-BR">
<head>
<title>Banners Randômicos</title>
<meta charset="UTF-8" />
<script type="text/javascript">
// cria a função para banners randômicos
function rand_banners(valor){
// transforma a variável "valor" em um Array, cortando a string pela virgula
banners = valor.split(',');
@claudiosanches
claudiosanches / custom_gravatar.php
Created April 12, 2012 16:32
Wordpress custom gravatar
<?php
// Coloque isso no functions.php
if ( !function_exists('my_new_gravatar') ) {
function cs_new_gravatar( $avatar_defaults ) {
// Suba a imagem para a pasta images do tema
$myavatar = get_bloginfo('template_directory').'/images/SUAIMAGEM.jpg';
// Inseria o nome do gravar que vai aparecer em Configurações > Discussão
$avatar_defaults[$myavatar] = 'NOME DO GRAVATAR';
return $avatar_defaults;}
add_filter( 'avatar_defaults', 'cs_new_gravatar' );
@claudiosanches
claudiosanches / ieplaceholder.js
Created April 12, 2012 16:33
IE Placeholder
$(document).ready(function() {
// Placeholder para browsers antigos
// Importante usar o placeholder="" corretamente para o script rodar
$('input[placeholder]').each(function(){
var ph = $(this).attr('placeholder');
$(this).val(ph).focus(function(){
if($(this).val() == ph) $(this).val('');
}).blur(function(){
if(!$(this).val()) $(this).val(ph);
});
@claudiosanches
claudiosanches / default_text.css
Created April 13, 2012 01:14
Wordpress Default text CSS
/* Text elements */
p {margin-bottom:1.625em;}
ul, ol {margin:0 0 1.625em 2.5em;}
ul {list-style:circle;}
ol {list-style-type:decimal;}
ol ol {list-style:upper-alpha;}
ol ol ol {list-style:lower-roman;}
ol ol ol ol {list-style:lower-alpha;}
ul ul, ol ol, ul ol, ol ul {margin-bottom:0;}
dl {margin:0 1.625em;}
@claudiosanches
claudiosanches / functions.php
Created May 1, 2012 18:31
Custom category posts per page
<?php
// Custom category posts per page
function cs_category_posts_per_page($query) {
if (is_category()) {
$query->query_vars['posts_per_page'] = 5;
return;
}
}
add_filter('pre_get_posts', 'cs_category_posts_per_page');
?>
@claudiosanches
claudiosanches / style.css
Created May 3, 2012 18:39
Facebook comment responsive
.fb-comments, .fb-comments iframe, .fb_iframe_widget span {
width: 100% !important;
}
<!DOCTYPE html>
<html dir="ltr" lang="pt-BR">
<head>
<title></title>
<meta charset="UTF-8" />
<style>
/* oculta o tooltip na hora que carrega a página, é importante ter isso */
.tooltip {
display: none;
}
@claudiosanches
claudiosanches / exemplo-media-queries-condicoes.html
Created May 19, 2012 20:03
Layout Responsivo #01: Introdução
<!DOCTYPE html>
<html>
<head>
<title>Exemplo de Media Types</title>
<!-- todos os dispositivos -->
<link href="estilos.css" rel="stylesheet" type="text/css" media="all" />
<!-- monitores e com largura máxima de 600px (por exemplo tablets) -->
<link href="estilo1.css" rel="stylesheet" type="text/css" media="screen and (max-width: 800px)" />
<!-- apenas para monitores coloridos -->
<link href="estilo2.css" rel="stylesheet" type="text/css" media="only screen and (color)" />
@claudiosanches
claudiosanches / layout-fluido-hibrido-ie.html
Created May 26, 2012 15:24
Tudo sobre Layout Responsivo #02: Diferenças entre Layout Responsivo e Fluido
<!DOCTYPE html>
<html dir="ltr" lang="pt-BR">
<head>
<title>Layout Fluido Hibrido - IE Hack</title>
<meta charset="UTF-8" />
<!-- CSS -->
<style>
* {margin:0;padding:0}
.clear {clear:both;}
#wrap {max-width:960px;min-width:600px;margin:0 auto;}