Skip to content

Instantly share code, notes, and snippets.

View jhonnymoreira's full-sized avatar

Jhonny Moreira jhonnymoreira

View GitHub Profile
UPDATE
segments
SET
name = REPLACE(name, '%.protonmail.com%', '.proton.me');
UPDATE
urls
SET
url = REPLACE(url, '%.protonmail.com%', '.proton.me');
@jhonnymoreira
jhonnymoreira / getMEIDebt.js
Created August 30, 2020 22:31
Calculo da quantia a ser paga de DAS-MEI em um determinado intervalo.
const getMEIDebt = (indexBegin, length) => {
const NODE_SELECTOR = '.total.updatable.text-center';
const sum = (x, y) => x + y;
const normalizeValue = (value) =>
value.replace('R$', '').replace(',', '.').trim();
return Array.from(document.querySelectorAll(NODE_SELECTOR))
.slice(indexBegin, length)
.map((node) => parseFloat(normalizeValue(node.innerText)))
const RANKS_WEIGHTS = {
'Iron 1': 1,
'Iron 2': 2,
'Iron 3': 3,
'Bronze 1': 4,
'Bronze 2': 5,
'Bronze 3': 6,
'Silver 1': 7,
'Silver 2': 8,
'Silver 3': 9,
@jhonnymoreira
jhonnymoreira / Dockerfile
Last active July 12, 2024 02:38
rbenv with Docker and Ubuntu 18.04
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
autoconf \
bison \
build-essential \
curl \
gcc-6 \
git \
libffi-dev \

SQL Learning

SQL means Structured Query Language. It is a language designed to manage data stored in relational databases.


Concepts

Relational Databases

const parseCookies = cookies =>
cookies.split(/;\s?/)
.reduce((parsedCookie, cookie) => {
const [key, value] = cookie.split('=')
parsedCookie[key] = (value
? value
: '')
return parsedCookie
export function add(x: number, y: number): number
export function subtract(x: number, y: number): number
rows = [
[9, 0, 5, 0, 0, 8, 0, 0, 2],
[0, 0, 8, 0, 0, 0, 5, 0, 0],
[0, 4, 0, 0, 3, 5, 0, 6, 9],
[4, 0, 3, 7, 0, 2, 0, 0, 0],
[0, 0, 7, 0, 4, 0, 2, 0, 0],
[0, 0, 0, 3, 0, 9, 6, 0, 4],
[2, 8, 0, 4, 9, 0, 0, 1, 0],
[0, 0, 9, 0, 0, 0, 4, 0, 0],
[5, 0, 0, 8, 0, 0, 7, 0, 6]

Vue Learning

Directives

Special attributes provided by Vue, which applies reactive behavior to the rendered DOM.

Each directive is prefixed with a v-. Here a list of all directives:

Conditional Directives

@jhonnymoreira
jhonnymoreira / dig.js
Last active May 12, 2017 19:25
An oneliner dig function for JavaScript.
/**
* @function
*
* Returns the value of a path to be found within an object.
*
* @param {Object} [from] The object to search
* @param {Array} [path] The path to search within object
*
* @return {*} The value from path search
*/