Skip to content

Instantly share code, notes, and snippets.

View brenopolanski's full-sized avatar
🦙
Llama Llama

Breno Polanski brenopolanski

🦙
Llama Llama
View GitHub Profile
@brenopolanski
brenopolanski / wordpress-localhost-online.md
Last active August 29, 2015 14:14
Mover site em wordpress de localhost para hospedagem online

via: mochileirodigital

Rodar queries para atualizar os dados importados

O wordpress guarda referências no banco de dados do endereço de instalação (que no nosso caso é o localhost). Temos que atualizar essas referências para o endereço da hospedagem online (ou seja: www.exemplo.com.br).

Para isso temos que rodar 3 queries na seguinte sequência:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.enderecoantigo.com', 'http://www.endereconovo.com') WHERE option_name = 'home' OR option_name = 'siteurl';
@brenopolanski
brenopolanski / plugin-jsplumb-event.md
Created January 27, 2015 00:19
Plugin jsPlumb console.log event connectionMoved and connectionDetached
jsPlumb.bind('connectionMoved', function(info) {
    console.log('##### Moved #####');
    console.log(info);

    var newSource      = $(info.newSourceEndpoint.element).find('.table-name').text(),
        newTarget      = $(info.newTargetEndpoint.element).find('.table-name').text(),
        originalSource = $(info.originalSourceEndpoint.element).find('.table-name').text(),
        originalTarget = $(info.originalTargetEndpoint.element).find('.table-name').text();

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@brenopolanski
brenopolanski / wp-login-htaccess.md
Created February 1, 2015 21:56
Modificar url para acessar painel de administração WordPress

Para isto vamos precisar editar o arquivo .htaccess.

RewriteRule ^login$ http://seu-site.com.br/wp-login.php [NC,L]

Agora basta acessar http://seu-site.com.br/login para entrar na sua conta WordPress.

@brenopolanski
brenopolanski / error-jq-illegal-invocation.md
Created February 5, 2015 01:17
Error jQuery Illegal invocation

Set processData equal to false.

processData (default: true): By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.

@brenopolanski
brenopolanski / save-data-saiku-file.md
Last active August 29, 2015 14:15
Save the data in Saiku file

To save the data in Saiku file, you must add in this.workspace.query:

For example:

var foo = { name: 'Lorem Ipsum' };

// Set
this.workspace.query.setProperty('saiku.ui.plugin.options', foo);
@brenopolanski
brenopolanski / option-selected-jquery.md
Created February 25, 2015 00:48
Make first option of <select > selected with jQuery
$('#target option:first').attr('selected', 'selected');
@brenopolanski
brenopolanski / execute-sh-linux.md
Created March 1, 2015 03:19
Execute .sh in Linux
$ sudo chmod +x file-name.sh
$ sh file_name.sh
@brenopolanski
brenopolanski / execute-jar-linux.md
Created March 1, 2015 03:21
Execute .jar in Linux
java -jar file-name.jar