┌────────────────────────────┐
│ x × (lMax - lMin) │
│ ─────────────────── + lMin │
│ gMax - gMin │
├────────────────────────────┴──┐
│ x → Valor para comparação. │
│ lMax → Máximo do menor. │
│ lMin → Mínimo do menor. │
│ gMax → Máximo do maior. │
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterObj(obj, cb) { | |
const newObj = {}; | |
const entries = Object.entries(obj); | |
for (entry of entries) { | |
const [key, val] = entry; | |
if (cb(key)) { | |
newObj[key] = val; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hex2rgb = colorHex => eval(colorHex.replace(/^#?(.{2})(.{2})(.{2})$/, '({r:0x$1,g:0x$2,b:0x$3})')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hex2rgb = (colorHex) => colorHex | |
.match(/(.{2})(.{2})(.{2})/) | |
.slice(1) | |
.map((hexVal) => parseInt(hexVal, 16)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
// Algorítmos: Pragramando em JavaScript na língua portuguesa. | |
// | |
programa('Verificador de Maioridade', ($) => { | |
var nome = 'Matheus' | |
var idade = 19 | |
$.se(nome >= 18).então(() => { | |
$.escreva(nome, 'é maior de idade.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Link as GatsbyLink } from 'gatsby' | |
const Link = ({ children, ...props }) => { | |
if (!props.href) { | |
return ( | |
<GatsbyLink {...props}> | |
{children} | |
</GatsbyLink> | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.md { | |
line-height: 180%; | |
font-size: 16px; | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
.md * { | |
box-sizing: border-box; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 'Todo', 'professor', 'tem', 'vários', 'alunos', '.' ] | |
[ | |
{ | |
valor: 'Todo', | |
cru: 'todo', | |
tipo: 'quantidade', | |
formula: (x) => x === x | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# gamp | |
# | |
# GIT: Add, commit and push in a single command. | |
# | |
# Created on: 2019-02-16 | |
# Author: Matheus Alves <[email protected]> | |
# License: MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterProps(obj, props) { | |
var newObj = {} | |
var keys = Object.keys(obj); | |
for (var i in keys) { | |
var key = keys[i] | |
if (props.includes(key)) { | |
newObj[key] = obj[key] | |
} |