Skip to content

Instantly share code, notes, and snippets.

Luís Felipe de Andrade luisfdeandrade

Block or report user

Report or block luisfdeandrade

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:a8a99cb75ce4361ee003
git rev-list --all --objects | \
sed -n $(git rev-list --objects --all | \
cut -f1 -d' ' | \
git cat-file --batch-check | \
grep blob | \
sort -n -k 3 | \
tail -n40 | \
while read hash type size; do
echo -n "-e s/$hash/$size/p ";
done) | \
View gist:7b2fddc8852d424775ff
* This scripts changes all occurrences of a URL in your WordPress database.
* It will compare the $newUrl against the URL saved on you wp_options table (site_url), or in the domain column of the wp_sites table for a Multi Site installation.
* It will handle serialized data and Objects stored in the database.
luisfdeandrade / command_line_sublime_text_3
Created Jan 29, 2015
Setting up Sublime to open in Mac command line
View command_line_sublime_text_3
ln -s /Applications/Sublime\ /usr/local/bin/sublime
Created Oct 21, 2014
Wordpress - Taxonomy Intersection
* Get all terms of $tax_to taxonomy that posts in $term_from of $tax_from have.
* @param string $tax_from taxonomy name
* @param string $term_from term slug
* @param string $tax_to taxonomy name
View wp_sql_delete_orfans
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id

Mostrar somente os últimos arquivos alterados no log do git

Esse exemplo mostra todos os arquivos alterados nos últimos dois dias, sem repetir:

git log --pretty=format: --name-only --since="2 days ago" | sort | uniq
luisfdeandrade / prioridade_yoast.php
Created Mar 12, 2014
Setting Yoast Metabox priority low
View prioridade_yoast.php
function lower_wpseo_priority( $html )
return 'low';
add_filter( 'wpseo_metabox_prio', 'lower_wpseo_priority' );
luisfdeandrade / gist:8578144
Created Jan 23, 2014
Mensagem validação custom post type
View gist:8578144
function save_post_representante() {
$representante = get_post($clientes[$cliente]);
$erro = 'O cliente "<strong> '. $representante->post_title. '</strong> " já está cadastrado para o representante "'. $post->post_title.'" ';
} set_transient( get_current_user_id().'missingfield', $erro );
function representante_validacao() {
if($out = get_transient( get_current_user_id().'missingfield' ) ) {
delete_transient( get_current_user_id().'missingfield' );
luisfdeandrade / gist:8577285
Last active Jan 4, 2016
Searching posts by multiple meta_key values.
View gist:8577285
// Change ids to int.
foreach ($clientes as $key => $value) {
$clientes[$key] = (int) $value;
$args = array(
'post_type' => 'clientes',
'post_status' => 'publish',
View gist:7679271
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
You can’t perform that action at this time.