Skip to content

Instantly share code, notes, and snippets.

View emanoelqueiroz's full-sized avatar
💻
Programming...

Emanoel Queiroz emanoelqueiroz

💻
Programming...
View GitHub Profile
@emanoelqueiroz
emanoelqueiroz / remover-acentos.js
Last active August 8, 2017 17:40 — forked from marioplumbarius/remover-acentos.js
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos(str) {
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,
i : /[\xEC-\xEF]/g,
@emanoelqueiroz
emanoelqueiroz / number-utils.js
Last active August 10, 2017 11:30
Utilitários para tratar de números.
/**
* Utilitários para tratar de números.
*/
export default {
/**
* Método para deixar apenas números na string.
*
* @param {String} str String que será manipulada.
* @return {String} Retorna apenas os números da string.
@emanoelqueiroz
emanoelqueiroz / electron_context_menu.js
Created September 25, 2017 13:06 — forked from luizcarraro/electron_context_menu.js
[ELECTRON] Menu-contexto com opções de copiar, colar e cortar em inputs e divs
(function () {
'use strict';
const remote = require('electron').remote;
const Menu = remote.Menu;
const MenuItem = remote.MenuItem;
const isAnyTextSelected = function () {
return window.getSelection().toString() !== '';
};
@emanoelqueiroz
emanoelqueiroz / gerartag.md
Last active December 7, 2017 19:08
Comandos para gerar nova versão das tags

Comandos para gerar nova versão das tags

Para gerar uma nova versão da tag seguir os seguintes passos:

  1. Comitar tudo para dev e depois para a master.
  2. Executar o comando de merge da dev para a master git merge dev.
  3. Executar o comando npm version parametro-versão na branch master.
  4. Executar o comando git push --follow-tags na branch master para gerar a nova versão.

Opção de parâmetros para o comando npm version:

  • patch irá mudar a ultima casa da versão.
function ajax(obj) {
'use strict';
if (!obj || typeof obj !== 'object') throw new Error('Object parameter is null or undefined.');
obj = {
url: obj.url || null,
type: obj.type || 'json',
method: obj.method || 'GET',
success: obj.success || null
function invertColor(hex, bw) {
if (hex.indexOf('#') === 0) {
hex = hex.slice(1);
}
// convert 3-digit hex to 6-digits.
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
if (hex.length !== 6) {
throw new Error('Invalid HEX color.');
@emanoelqueiroz
emanoelqueiroz / dani.js
Last active November 29, 2017 18:37
Código Preciso
var dataDb = [{
id: 1,
dataIni: new Date('2017-01-20'),
dataFin: new Date('2017-01-24'),
val: 50
},
{
id: 2,
dataIni: new Date('2017-01-25'),
dataFin: new Date('2017-02-08'),
@emanoelqueiroz
emanoelqueiroz / Git checkout remote branch.md
Last active November 30, 2017 11:05 — forked from markSci5/Git checkout remote branch
Git checkout remote branch

With newer versions of git you can just enter:

$ git fetch
$ git checkout <branch>

git fetch will fetch all the remote branches, which you can verify with git branch -r (or git branch -rv), and as long as you don't have an existing branch with the name you want, you can just switch directly to it with git checkout <branch>. All this behavior assumes the default configuration for fetching "refs" for all remote branches and tags, which you can override with options or by configuring the remote. See git fetch --help for details. I like to also include the -p (--prune) option for removing dead remote-tracking refs for refs that have since been deleted on the remote.

To fetch a branch, you simply need to:

@emanoelqueiroz
emanoelqueiroz / tutorial font jasper reports.md
Last active December 7, 2017 16:44
Tutorial para colocar Embed Fonts do Jasper Reports no projeto Spring Boot.

Tutorial para colocar Embed Fonts do Jasper Reports no projeto Spring Boot.

Passo 1:

  • No Jasper, ir no menu Window -> Preferences -> Fonts.
  • Clique no botão Add para adicionar uma nova fonte.
  • Coloque o nome da fonte que vc desejar.
  • Ache a fonte no seu computador para cada aba (ou só aquelas que tu quer importar, no meu caso apenas Normal e Bold).
  • Depois em PDF Font Name selecione a fonte de base (No meu caso a base da Arial é a Helvetica).
  • Em PDF Details selecione o PDF Encoding e depois marque a opção Embed this font in PDF document;
@emanoelqueiroz
emanoelqueiroz / asd.git
Created April 11, 2018 11:10
Comando para guardar login do usuario
git config --global credential.helper store