This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset> | |
<legend>Todas as palestras</legend> | |
<?php // WP_Query arguments | |
$args = array ( | |
'post_type' => array( 'palestra' ), | |
); | |
// The Query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sips -Z 1024 *.jpg | |
# Mantendo a imagem original e salvando as imagens redimensionadas em outro diretório | |
sips -Z 1024 *.jpg --out /Users/leobaiano/photo/scaleddown/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It's dangerous to go alone! Take this | |
sudo su | |
| |
# Update | |
apt-get update | |
apt-get upgrade | |
| |
# Install Apache2 | |
apt-get install apache2 | |
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validaCPF(cpf) | |
{ | |
var numeros, digitos, soma, i, resultado, digitos_iguais; | |
digitos_iguais = 1; | |
if (cpf.length < 11) | |
return false; | |
for (i = 0; i < cpf.length - 1; i++) | |
if (cpf.charAt(i) != cpf.charAt(i + 1)) | |
{ | |
digitos_iguais = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// nome do campo personalizado que tem a URL da imagem | |
$nome_do_campo_imagem = ''; | |
// inclue a classe que cuida das imagens no WordPress | |
require_once( ABSPATH . 'wp-admin/includes/image.php' ); | |
// Cria uma instancia de WP_Query que retorna todos os posts do tipo post | |
// Se tiver muitos posts é bom fazer a migração em lotes, para isso utilize o offset | |
// Exemplo: $obj = new WP_Query ( array( 'post_type' => 'post', 'posts_per_page' => '500', 'offset' => '499' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ionic Starter App | |
// angular.module is a global place for creating, registering and retrieving Angular modules | |
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) | |
// the 2nd parameter is an array of 'requires' | |
// 'starter.services' is found in services.js | |
// 'starter.controllers' is found in controllers.js | |
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']) | |
.run(function($ionicPlatform) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$upload_dir = wp_upload_dir(); | |
echo $upload_dir['path']; | |
$folder = $upload_dir['path'] . '/*'; | |
foreach( glob($folder) as $files ){ | |
$size = filesize($files); | |
// if( $size < 10240 ){ | |
echo $files . '( ' . formatSizeUnits( $size ) . ')<br />'; | |
// } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_admin_post_search_by_custom_fields( $query ) { | |
if ( ! is_admin() ) { | |
return; | |
} | |
// Search just for posts | |
if ( isset( $query->query_vars['post_type'] ) && 'post' !== $query->query_vars['post_type'] ) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_search( $query ) { | |
if ( !is_admin() && $query->is_main_query() && $query->is_search ) { | |
$tax_query = array( | |
array( | |
'taxonomy' => 'frutas', | |
'field' => 'slug', | |
'terms' => 'laranja' | |
), | |
array( |