Skip to content

Instantly share code, notes, and snippets.

View DraCaster's full-sized avatar
:octocat:
Trabajando desde casa

Lushan DraCaster

:octocat:
Trabajando desde casa
View GitHub Profile
@DraCaster
DraCaster / easy.md
Last active October 30, 2023 22:23
Generar SSH-Key, para gente que quiere todo ya.

Si te cuesta, te olvidaste, o te da fiaca entrar a la docu de Github para generarte la SSH-Key que te permite conectarte a tu cuenta, es simple:

  1. Abri tu consola y pegá el siguiente código reemplazando el email tuyo:
ssh-keygen -t ed25519 -C "tu_email"
  1. Dale todo que si, enter, enter, enter jeje
@DraCaster
DraCaster / index.js
Created August 27, 2021 01:57
What is the best way to get the key of key/value javascript object?
/** There are many roads, these are some of them... :) **/
const myObject = {name: 'Lujan', nickname: 'Lushan'}
for(let key in myObject){
console.log(`Key: ${key}`);
console.log(`Keys value ${myObject[key]}`);
}
//Or
@DraCaster
DraCaster / aggregateWithMatchIdExample.js
Created June 7, 2021 19:49
Moongoose aggregate $match does not match id
/*Your id variable will be constructed of "string", and not ObjectId value.
Mongoose "autocasts" string values for ObjectId into their correct type in regular queries,
but this does not happen in the aggregation pipeline, as in described in issue #1399:
https://github.com/Automattic/mongoose/issues/1399
Instead you must do the correct casting to type manually:*/
import mongoose from 'mongoose'
id = mongoose.Types.ObjectId(anyModel)