Skip to content

Instantly share code, notes, and snippets.

View camonunez's full-sized avatar
🥦
piumm!

Camilo Núñez camonunez

🥦
piumm!
View GitHub Profile
@camonunez
camonunez / Cripto
Created December 4, 2021 22:24
Usa implementación de Webcrypto
import crypto from 'crypto'
import jwt from 'jsonwebtoken'
import { consolo } from './consolo'
const { subtle } = crypto.webcrypto
function btoa (str) { return Buffer.from(str).toString('base64') }
function atob (b64) { return Buffer.from(b64, 'base64').toString() }
function ab2str (buf) { return String.fromCharCode.apply(null, new Uint8Array(buf)) }
@camonunez
camonunez / Llavero (WIP)
Last active December 4, 2021 22:22
Clase llavero, para crear y usar para encriptacion y firma
import chalk from 'chalk'
import _ from 'lodash'
import { consolo } from './consolo'
import cripto from './cripto'
class Llavero {
constructor (nombre) {
// console.log('Construcción llavero', nombre)
this.nombre = nombre
@camonunez
camonunez / OsoCoder.vue
Created November 12, 2021 02:04
Componente visual de un Oso Coder animado. No me acuerdo de donde saqué el codigo T.T
<template lang="pug">
.osoCoder
svg(xmlns='http://www.w3.org/2000/svg' viewBox="0 0 300 300")
defs
g(id="code-block").code-block
rect(ry='0' y='862' x='60' height='7.5' width='74')
rect(ry='0' y='874' x='96' height='7.5' width='28')
rect(width='54' height='7.5' x='60' y='886' ry='0')
rect(ry='0' y='897' x='60' height='7.5' width='74')
rect(width='56' height='7.5' x='78' y='909' ry='0')
@camonunez
camonunez / regionesChile.js
Created September 21, 2021 19:41
Regiones, Provincias y comunas de Chile
import _ from 'lodash'
const chile = [
{
nombreCompleto: 'Región de Arica y Parinacota',
prefijo: 'Región de',
nombre: 'Arica y Parinacota',
romano: 'XV',
numero: '15',
iso_3166_2: 'CL-AP',
import { MongoClient } from 'mongodb'
let cliente
const configs = {
local: {
dbName: 'DatosDev',
url: 'mongodb://user:[email protected]:27017'
},
dev: {
@camonunez
camonunez / ejemploProveedor.json
Created July 4, 2019 22:17
Ejemplo de un proveedor de Boxmagic
{
"id": "ejemplo",
"nombre": "Gimnasio ejemplo",
"descripcion": "",
"redes": {
"email": "correo@dominio",
"telefono": "+56999999",
"facebook": "https://sasdfsafd",
"twitter": "https://sasdfsafd",
"instagram": "https://sasdfsafd",
@camonunez
camonunez / parametrizar.js
Last active November 12, 2021 01:56
Función para convertir caracteres no usuales en un string usable en urls
const Caracteres = {
LATIN_MAP: { À: 'A', Á: 'A', Â: 'A', Ã: 'A', Ä: 'A', Å: 'A', Æ: 'AE', Ç: 'C', È: 'E', É: 'E', Ê: 'E', Ë: 'E', Ì: 'I', Í: 'I', Î: 'I', Ï: 'I', Ð: 'D', Ñ: 'N', Ò: 'O', Ó: 'O', Ô: 'O', Õ: 'O', Ö: 'O', Ő: 'O', Ø: 'O', Ù: 'U', Ú: 'U', Û: 'U', Ü: 'U', Ű: 'U', Ý: 'Y', Þ: 'TH', ß: 'ss', à: 'a', á: 'a', â: 'a', ã: 'a', ä: 'a', å: 'a', æ: 'ae', ç: 'c', è: 'e', é: 'e', ê: 'e', ë: 'e', ì: 'i', í: 'i', î: 'i', ï: 'i', ð: 'd', ñ: 'n', ò: 'o', ó: 'o', ô: 'o', õ: 'o', ö: 'o', ő: 'o', ø: 'o', ù: 'u', ú: 'u', û: 'u', ü: 'u', ű: 'u', ý: 'y', þ: 'th', ÿ: 'y' },
LATIN_SYMBOLS_MAP: { '©': '(c)' },
GREEK_MAP: { α: 'a', β: 'b', γ: 'g', δ: 'd', ε: 'e', ζ: 'z', η: 'h', θ: '8', ι: 'i', κ: 'k', λ: 'l', μ: 'm', ν: 'n', ξ: '3', ο: 'o', π: 'p', ρ: 'r', σ: 's', τ: 't', υ: 'y', φ: 'f', χ: 'x', ψ: 'ps', ω: 'w', ά: 'a', έ: 'e', ί: 'i', ό: 'o', ύ: 'y', ή: 'h', ώ: 'w', ς: 's', ϊ: 'i', ΰ: 'y', ϋ: 'y', ΐ: 'i', Α: 'A', Β: 'B', Γ: 'G', Δ: 'D', Ε: 'E', Ζ: 'Z', Η: 'H', Θ: '8', Ι: 'I', Κ: 'K', Λ: 'L', Μ: 'M', Ν: 'N', Ξ: '3', Ο:
@camonunez
camonunez / Regiones de Chile 2018.js
Last active September 19, 2018 01:24
Regiones de Chile actualizadas al 6 de Septiembre del 2018, con sus provincias y comunas
export default [
{
nombreCompleto: 'Región de Arica y Parinacota',
prefijo: 'Región de',
nombre: 'Arica y Parinacota',
romano: 'XV',
numero: '15',
iso_3166_2: 'CL-AP',
provincias: [
{