Skip to content

Instantly share code, notes, and snippets.

View rogerramosme's full-sized avatar
🎯
Focusing

Roger Ramos rogerramosme

🎯
Focusing
View GitHub Profile

How to configure ssh key for Github

First generate a new key by running:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Enter a file in which to save the key or press Enter to save using defaults

Then add yout ssh key to your ssh-agent

@rogerramosme
rogerramosme / ubuntu_agnoster_install.md
Last active November 29, 2018 15:58 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@rogerramosme
rogerramosme / formatCurrencyBRL.js
Created October 9, 2018 18:55
Format currency BR using toLocalString
const formatCurrencyBRL = (price, showLeadingCurrency = true) => {
price = Math.round(price * 100) / 100;
const options = {
style: showLeadingCurrency ? "currency" : "decimal",
currency: "BRL",
minimumFractionDigits: 2
};
return price.toLocaleString(
@rogerramosme
rogerramosme / get_uniques_by_prop.js
Last active May 8, 2023 03:17
JavaScript: Count duplicates in an array of objects by property name
const users = [
{
id: 60,
name: "roger"
},
{
id: 60,
name: "roger"
},
{
@rogerramosme
rogerramosme / cloudSettings
Last active July 8, 2019 13:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-07-08T13:39:03.385Z","extensionVersion":"v3.3.1"}
@rogerramosme
rogerramosme / markup.html
Last active October 1, 2018 18:31 — forked from ihorduchenko/Amount of flex-items per row
Sass: How adjust amount of flex-items per row
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
@rogerramosme
rogerramosme / rename-branch-github.txt
Created March 29, 2018 21:58 — forked from niqdev/rename-branch-github.txt
Rename local and remote branch on GitHub
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@rogerramosme
rogerramosme / pre-commit-js[x]
Last active March 29, 2018 22:29 — forked from shettayyy/pre-commit-eslint
Pre-commit hook for Linting JS with ESLint before commit.
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@rogerramosme
rogerramosme / git-pretty-log
Created December 13, 2017 13:29
Git pretty log
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@rogerramosme
rogerramosme / promise.js
Last active December 4, 2017 11:31 — forked from jish/promise.js
An example "always" behavior for ES6 promises. This only works if you do not create / return intermediate promises.
// A thing I want to do
// This flow only involves **one** promise, for example an ajax call
// None of the subsequent `then` or `catch` calls, return new promises.
const explode = false;
const promise = new Promise((resolve, reject) => {
if (explode) {