Skip to content

Instantly share code, notes, and snippets.

View pedroelsner's full-sized avatar

Pedro R. Elsner Begosso pedroelsner

View GitHub Profile
<?php
$query = array(
'post_type' => 'servicos',
'post_status' => 'published',
'order' => 'ASC',
'orderby' => 'title',
'meta_query' => array(
array(
'key' => '_thumbnail_id',
@pedroelsner
pedroelsner / gist:3405257
Created August 20, 2012 15:44
For next - Qlikview
/**
* Carrega previamente lista de filiais
* Gera a tabela: Filiais
*/
// Número de filiais
Let vFilialCount = NoOfRows(Filiais);
For i = 0 to $(vFilialCount) - 1
@pedroelsner
pedroelsner / gist:3403845
Created August 20, 2012 13:01
My Git Alias
git config --global alias.st "status -s -b"
git config --global alias.di "diff"
git config --global alias.co "checkout"
git config --global alias.ci "commit"
git config --global alias.br "branch"
git config --global alias.l "log --online --decorate --graph"
git config --global alias.fixup "commit --amend -C HEAD"
git config --global alias.timeline "log --graph --branches --pretty=online --decorate"
git config --global alias.untracked-files "ls-files -o --exclude-standard"
git config --global alias.ignored-files "ls-files --others -i --exclude-standard"
@pedroelsner
pedroelsner / gist:3348613
Created August 14, 2012 11:47
Meio Mask Celular
// jQuery Meio Mask
$('#celular').setMask("(99) 9999-99999").ready(function(event) {
var target, phone, element;
target = (event.currentTarget) ? event.currentTarget : event.srcElement;
phone = target.value.replace(/\D/g, '');
element = $(target);
element.unsetMask();
if(phone.length > 10) {
element.setMask("(99) 99999-9999");
} else {
@pedroelsner
pedroelsner / gist:3336770
Created August 13, 2012 03:35
CHANGE - Regenerete Thumbnail Wordpress
<?php
// Process a single image ID (this is an AJAX handler)
function ajax_process_image() {
@error_reporting( 0 ); // Don't break the JSON result
header( 'Content-type: application/json' );
$id = (int) $_REQUEST['id'];
$image = get_post( $id );
@pedroelsner
pedroelsner / gist:3313379
Created August 10, 2012 10:57
Exemplo - AppServer.ini Protheus 11
[producao]
SourcePath=C:\Protheus11\APO
RootPath=C:\Protheus_Data
StartPath=\system\
x2_path=
RpoDb=dbf
RpoLanguage=portuguese
RpoVersion=110
LocalFiles=ads
Trace=0
@pedroelsner
pedroelsner / gist:3236137
Created August 2, 2012 10:31
Combobox - Estado & Cidade - FilterResults
<?php
$list_cidades = array('' => '');
$this->FilterResults->addFilters(
array(
'filter_estado' => array(
'Table.id_estado' => array(
'select' => $this->FilterResults->select('Estado', $this->Table->Estado->find('list'))
)
@pedroelsner
pedroelsner / gist:3212276
Created July 31, 2012 00:31
Masked Input Celular
// jQuery Masked Input
$('#celular').mask("(99) 9999-9999?9").ready(function(event) {
var target, phone, element;
target = (event.currentTarget) ? event.currentTarget : event.srcElement;
phone = target.value.replace(/\D/g, '');
element = $(target);
element.unmask();
if(phone.length > 10) {
element.mask("(99) 99999-999?9");
} else {
@pedroelsner
pedroelsner / gist:3212264
Created July 31, 2012 00:26
Masked Input
// jQuery Masked Input
$('#telefone').mask("(99) 9999-9999");
// jQuery Meio Mask
$('#telefone').setMask("(99) 9999-9999");
@pedroelsner
pedroelsner / gist:3161438
Created July 23, 2012 00:13
#3 - WP_query personalizado
<?php
// Seleciona todos os posts publicados
$query = new WP_query(
array(
'post_type' => 'post',
'post_status' => 'publish',
'title_like' => 'Treinamento%'
)
);