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 / how-to-clone-models-in-backbone.md
Last active August 29, 2015 14:13
How to Clone Models in Backbone

via: stackoverflow

You could use the clone method. Short example below:

var Model = Backbone.Model.extend({});
var View = Backbone.View.extend({
    initialize: function() {
        this.realModel = this.model;
 this.model = this.realModel.clone();
@brenopolanski
brenopolanski / check-url-parameters-saiku.md
Created January 12, 2015 13:43
Check URL parameters in Saiku
@brenopolanski
brenopolanski / FoodMart4.xml
Created January 14, 2015 13:34
FoodMart 4
<?xml version='1.0'?>
<Schema name='FoodMart' metamodelVersion='4.0'>
<!--
== This software is subject to the terms of the Eclipse Public License v1.0
== Agreement, available at the following URL:
== http://www.eclipse.org/legal/epl-v10.html.
== You must accept the terms of that agreement to use this software.
==
== Copyright (C) 2000-2005 Julian Hyde
== Copyright (C) 2005-2013 Pentaho and others
@brenopolanski
brenopolanski / jquery.outerhtml.js
Created January 21, 2015 18:52
A jQuery plugin to retrieve the outerHTML of an element
/*! Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*/
(function($){
var div;
$.fn.outerHTML = function() {
var elem = this[0],
@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);