Skip to content

Instantly share code, notes, and snippets.

View knoonrx's full-sized avatar
🎯
Focusing

Rodrigo Brandão knoonrx

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
<title>XLSX Reader JS</title>
<link rel="stylesheet" href="screen.css" media="screen">
</head>
<body>
@knoonrx
knoonrx / javascript.spread.ts
Last active May 1, 2019 19:42
Use the spread operator to remove duplicates items and to sort a array of numbers and objects, without destruct the original array.
// define the array of numbers and objects
const array = [{
nome: 'joão',
idade: 14
},{
nome: 'joão',
idade: 14
},7,9,8,5,15,3,9,8,6];
// remove duplicate numbers only, items of type object are not affected
@knoonrx
knoonrx / firebase-message
Created November 28, 2020 05:30 — forked from Albejr/firebase-message
Localize Firebase error messages in PT-BR
catchError(err => {
const errorCode = err.code;
let errorMessage = this.VerifyErroCode(errorCode);
if (errorMessage == null) {
errorMessage = err.message;
}
console.log(errorMessage);
})
@knoonrx
knoonrx / CryptoJSAES.php
Last active January 7, 2022 18:32
CryptoJS.AES.encrypt to PHP - PHP implementation to Encrypt and decrypt a string compatible with crypto-js library AES default settings
class CryptoJSAES
{
public function encrypt($passphrase, $data, $salt = null): string
{
$salt = $salt ?: openssl_random_pseudo_bytes(8);
[$key, $iv] = $this->_evpKDF($passphrase, $salt);
$ct = openssl_encrypt($data, 'aes-256-cbc', $key, true, $iv);
return $this->_encode($ct, $salt);
}