Skip to content

Instantly share code, notes, and snippets.

View fdaciuk's full-sized avatar
🔥

Fernando Daciuk fdaciuk

🔥
View GitHub Profile
@fdaciuk
fdaciuk / index.php
Created September 20, 2013 00:55
Chamada padrão para arquivos PHP
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<title>Teste</title>
</head>
<body>
<?php
// Verifica se o ?p foi passado na URL. Se foi, $p = o valor passado em ?p + .php (para dar include no arquivo)
// Senão, chama o arquivo home.php
@fdaciuk
fdaciuk / cep.js
Created September 18, 2013 18:00
Buscar endereço de webservice utilizando somente o CEP Dependëncias: jQuery
var cep_search = function( fields ) {
// Passa os campos em variáveis
var $field_cep = fields.cep
, $field_estado = fields.estado
, $field_cidade = fields.cidade
, $field_endereco = fields.endereco
, $field_bairro = fields.bairro
, $field_numero = fields.numero
@fdaciuk
fdaciuk / popup.html
Last active December 22, 2015 19:59
Abrir pop-up e fechar com ESC e clique no mesmo botão que abriu
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<title>Abrir/fechar pop-up</title>
</head>
<body>
<ul>
<li class="container-box-to-open">
<a class="el-open-box">Abrir Pop-up</a>
@fdaciuk
fdaciuk / wp_insert_post.php
Created September 7, 2013 16:51
Criar páginas no WordPress sem utilizar o painel com wp_insert_post
<?php
$default_configs = array(
'post_status' => 'publish',
'post_type' => 'page',
'comment_status' => 'closed',
'ping_status' => 'closed',
'post_content' => ''
);
$panel_pages = array(
@fdaciuk
fdaciuk / es.sh
Created August 31, 2013 17:34
Instalar ElasticSearch no Ubuntu
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.deb
sudo dpkg -i elasticsearch-0.90.0.deb
@fdaciuk
fdaciuk / placeholder_polyfill.js
Created August 20, 2013 18:22
Polyfill para placeholder
$formLogin = $( 'form.form-login' );
$formLogin.find( 'label' ).addClass( 'js' );
$formLogin.find( 'input[type=text], input[type=password]' ).each(function(){
// Verifica se os campos estão preenchidos (autocompletar do browser)
if( $( this ).val() !== '' ) {
$( this ).prev( 'label' ).animate({'font-size' : 0}, 200);
}
$( this ).focus(function(){
@fdaciuk
fdaciuk / carousel.js
Last active December 21, 2015 02:28
Carousel Usando jCarousel v3
@fdaciuk
fdaciuk / Gruntfile.js
Created August 14, 2013 13:29
Gruntfile para rodar o beautiful-docs
module.exports = function( grunt ) {
grunt.initConfig({
coffee : {
compile : {
files : {
'lib/command.js' : 'src/command.coffee',
'lib/generator.js' : 'src/generator.coffee',
'lib/index.js' : 'src/index.coffee',
'lib/manifest.js' : 'src/manifest.js'
}
@fdaciuk
fdaciuk / Adicionar novo campo (custom field) a uma taxonomia (categoria, tag, etc) no WordPress.md
Last active March 18, 2025 21:55
Adicionar novo campo (custom field) a uma taxonomia no WordPress (Incluir esse código no functions.php)Nas action_hooks, no lugar de "category" é só incluir o slug da sua taxonomia :)

Adicionar novo campo (custom field) a uma taxonomia (categoria, tag, etc) no WordPress

Incluir esse código no functions.php.

Nas action_hooks, no lugar de "category" é só incluir o slug da sua taxonomia :)

@fdaciuk
fdaciuk / functions.php
Created July 28, 2013 19:43
Adicionar metaboxes a pages específicas no WP
<?php
/*
Adicionar metabox à páginas específicas
*/
function my_meta_setup_1() {
// criação da metabox
}
function especific_metabox_pages() {
$post_ID = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];