Skip to content

Instantly share code, notes, and snippets.

View roalcantara's full-sized avatar
🤖
Don't Panic!

Rogério Rodrigues de Alcântara roalcantara

🤖
Don't Panic!
View GitHub Profile
@roalcantara
roalcantara / git-branch-select.md
Last active September 5, 2019 15:16
Interactive (local) branch selection in repositories
@roalcantara
roalcantara / increase_key_repeat_rate.sh
Last active November 26, 2022 03:07
Increase the Key repeat rate in Mac OS
# reset the system defaults
# xset r rate
# output the current InitialKeyRepeat`value
defaults read NSGlobalDomain InitialKeyRepeat
# output the current KeyRepeat`value
defaults read NSGlobalDomain KeyRepeat
# disable alternate characters when holding a key
@roalcantara
roalcantara / links_tecnologia_e_negocios_digitais.md
Last active August 24, 2019 16:16
Tecnologia e Negócios Digitais
@roalcantara
roalcantara / README.md
Created August 19, 2019 23:47
VSCode: Surround selection with double or single quotation marks

VSCode: Surround selection with double or single quotation marks

Directions

  1. In VS Code, hold Command + Shift + P (for mac) or Ctrl + Shift + P
  2. Type Preferences: Open Keyboard Shortcuts (JSON) and press [Enter]
  3. On keybindings.json, paste and adapt if so the vscode_keybindings_surroundings.json's content
@roalcantara
roalcantara / get_all_erros.ts
Created April 24, 2018 15:57
Get All Angular 2 Form Errors
getAllErrors(form: FormGroup | FormArray): { [key: string]: any; } | null {
let hasError = false
const result = Object.keys(form.controls).reduce((acc, key) => {
const control = form.get(key)
const errors = (control instanceof FormGroup || control instanceof FormArray)
? this.getAllErrors(control)
: control.errors
if (errors) {
acc[key] = errors
@roalcantara
roalcantara / cloud_firestore_security_rules_helper_functions.rules
Created March 9, 2018 01:46
Cloud Firestore Security Rules Helper Functions
service cloud.firestore {
match /databases/{database}/documents {
// USERS //
function isAuthenticated() {
return request.auth != null;
}
function userExists(uid) {
@roalcantara
roalcantara / add_to_array.js
Created January 28, 2018 23:10
ElasticSearch: Append to array
const created_by = '12345566';
const script = 'if (ctx._source.raters == null) { ctx._source.raters = [] } \
if (ctx._source.raters.indexOf(params.created_by) == -1) {\
ctx._source.raters.add(params)\
}';
return this.client.update({
index: 'index',
type: 'type',
id: 'key',
body: {
@roalcantara
roalcantara / 01_pg_load.sh
Last active December 18, 2017 20:37
PGLoader from Mysql To Public Schema Fixing TimeStamp columns
# Load data from mysql to postgres
$ pgloader mysql://username:password@localhost/dbname pgsql:///dbname
@roalcantara
roalcantara / generate_pub_key.sh
Created December 15, 2017 15:29
Generate key par
openssl genrsa -out my-key.pem 2048
openssl rsa -in my-key.pem -pubout > my-key.pub
@roalcantara
roalcantara / Dockerfile
Last active December 14, 2017 19:13
Dockerized GIT Deployment Angular2 on Nginx
FROM alpine/git:latest AS git
MAINTAINER roalcantara <[email protected]>
# Required Environment Variables
ARG NG_ENV=prod
ARG GIT_REPO
ARG GIT_BRANCH=master
## Clone the git repository