Skip to content

Instantly share code, notes, and snippets.

View EstebanBorai's full-sized avatar

Esteban Borai EstebanBorai

View GitHub Profile
@EstebanBorai
EstebanBorai / secret-of-life.md
Created June 19, 2021 18:59
GitHub PR: Push & pull from contributor upstream

GitHub PR: Push & pull from contributor upstream

Push to PR

# git push git@github.com:<username>/<repository>.git <upstream-branch>:<local-branch>

git push git@github.com:EstebanBorai/repository-name.git fix-documentation:fix-typo-in-documentation
@EstebanBorai
EstebanBorai / mdsample.md
Last active May 29, 2021 06:38
Markdown Example
{
"theme": "Default Dark.sublime-theme",
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"font_face": "Courier New",
"font_size": 14,
"draw_white_space": "all",
"rulers": [80],
"font_options": [
"no_italic",
"no_bold",
@EstebanBorai
EstebanBorai / token-generator.js
Created May 9, 2021 01:38 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@EstebanBorai
EstebanBorai / validarRUT.html
Created May 4, 2021 21:02 — forked from gaulatti/validarRUT.html
HTML5 Chilean RUT Validator
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Validador de RUT HTML5</title>
</head>
<body>
<form>
<input type="text" id="rut" name="rut" required oninput="checkRut(this)" placeholder="Ingrese RUT">
<button type="submit">Validar RUT y Enviar Form</button>
@EstebanBorai
EstebanBorai / knex.js
Created February 2, 2021 14:34 — forked from odigity/knex.js
Wrapping a unit test in a transaction for easy cleanup with Knex.js
#!/usr/bin/node
const Promise = require('bluebird')
const config = require('./config.json')
const knex = require('./lib/knex')(config.database).connection()
const mock = () => ({ user_id: Math.floor(Math.random() * 999) + 1, payload_type: 'foo', attributes: JSON.stringify({}) })
const before = (t) => {
@EstebanBorai
EstebanBorai / Setting up an SQL Project
Created January 18, 2021 13:17
Setting up an Knex SQLite3 project from scratch
Configuring the setup
1. Setting up the dependices
yarn init -y (Initalises a packag.json with the default values)
yarn add knex sqlite3 (Add knex sqlite module)
yarn add jest --dev (Add jest to dev dependices)
2. Adding scripts to the package.json file
@EstebanBorai
EstebanBorai / parse_dotenv.bash
Created November 23, 2020 19:26 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@EstebanBorai
EstebanBorai / find_string_example.rs
Created November 22, 2020 23:39 — forked from patshaughnessy/find_string_example.rs
Rust Vec<String> find example
fn main() {
let needle = "list".to_string();
let haystack = ["some".to_string(), "long".to_string(), "list".to_string(), "of".to_string(), "strings".to_string()].to_vec();
if let Some(str) = haystack.iter().find(|&s| *s == needle) {
println!("{}", needle);
} else {
println!("Nothing there...");
}
}