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 / 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 / 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 / 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,