Skip to content

Instantly share code, notes, and snippets.

View charlesrochati's full-sized avatar

Charles R. Dantas charlesrochati

View GitHub Profile
@charlesrochati
charlesrochati / gist:b1ab7069edcf02c932725a55764dca04
Created August 8, 2019 13:20 — forked from mrtns/gist:78d15e3263b2f6a231fe
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@charlesrochati
charlesrochati / gist:b8f817a070c1bf3301661b41f122feee
Created August 8, 2019 13:20 — forked from mrtns/gist:78d15e3263b2f6a231fe
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@charlesrochati
charlesrochati / ApplicationContextHolder.java
Created November 27, 2018 17:23 — forked from ufuk/ApplicationContextHolder.java
Utility bean for getting Spring beans from static context.
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@charlesrochati
charlesrochati / cpf_cnpj_validator
Created May 31, 2018 16:10 — forked from igorcosta/cpf_cnpj_validator
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@charlesrochati
charlesrochati / AvoidIfs.js
Last active May 10, 2018 21:37
simple way to write conditional blocks without using if/else in javascript
const run = execute => {
let result;
return {
if: predicate => {
if (predicate) result = execFunctionIfValid(execute);
return {
otherwise: handleThis => {
if (handleThis && typeof handleThis === 'function') {
if (!predicate) result = execFunctionIfValid(handleThis);
} else if (!predicate) result = handleThis;
@charlesrochati
charlesrochati / .babelrc
Created April 12, 2018 17:02 — forked from thejmazz/.babelrc
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
@charlesrochati
charlesrochati / gitflow-breakdown.md
Created January 27, 2018 12:17 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@charlesrochati
charlesrochati / .html
Created January 15, 2018 13:11
ngDialog angular 1.6
<script type="text/ng-template" id="firstDialogId">
<div><h1>Shit</h1></div>
</script>
<script text="javascript">
vm.clickToOpen = function () {
ngDialog.open({
template: 'firstDialogId',
controller: 'GroupController',
className: 'ngdialog-theme-default'

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
//CommonsJS
var x = require('x');
//ES6 import syntax
import * as x from 'x';// import x from 'x';