Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️
Learn while you run.

April Mintac Pineda aprilmintacpineda

🏃‍♂️
Learn while you run.
View GitHub Profile
@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active Jul 11, 2021
Beginner Friendly: Using Multiple SSH keys
View Using Multiple SSH keys - Beginner Friendly.md

How to follow this guide

The problem

I have one computer and two different github accounts. One is for work, the other is for my personal stuff. I can't use the same ssh key twice, so I have to use different ssh key for each of my accounts. How do I do that? How do I switch between these ssh keys?

View NOT USING TYPESCRIPT.md

This setup achieves:

  • Imports will be resolved from /src folder.
  • Code formatter and linter that works with the import module resolver.
  • Setup react-hooks linting

NOT using TypeScript

1. Install dependencies

View .eslintrc.js
module.exports = {
env: {
browser: true,
node: true,
es6: true,
'jest/globals': true
},
root: true,
plugins: ['jest', 'react'],
extends: [
@aprilmintacpineda
aprilmintacpineda / NodeJS require local modules resolver.md
Last active Nov 4, 2020
NodeJS require concept for local modules
View NodeJS require local modules resolver.md

NodeJS require concept for local modules

The problem

As your NodeJS app grows bigger, the file structure tends to go 3 to even 5 layers deep. The problem now is as you require local modules you created, you'll have to write them in this way:

const myModule = require('../../../my/module');
@aprilmintacpineda
aprilmintacpineda / nested-fql-template.js
Created Jun 18, 2020 — forked from ptpaterson/nested-fql-manual.js
Template for building deeply nested FQL queries for FaunaDB
View nested-fql-template.js
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms));
// or
// const baseQuery = q.Paginate(q.Collection(collectionName))
const expandedQuery = q.Map(baseQuery, (ref) =>
q.Let(
{
instance: q.Get(q.Var('ref'))
},
{
View lifecycle-cheat-sheet.md

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@aprilmintacpineda
aprilmintacpineda / serverless.yml
Created Apr 30, 2020 — forked from DavidWells/serverless.yml
DynamoDB custom index serverless.yml example
View serverless.yml
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@aprilmintacpineda
aprilmintacpineda / node_nginx_ssl.md
Created Feb 9, 2020 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL
View node_nginx_ssl.md

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@aprilmintacpineda
aprilmintacpineda / jwt.sh
Last active Jan 25, 2020 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
View jwt.sh
# Don't add passphrase
ssh-keygen -t rsa -b 4096 -m PEM -f jwt.key
openssl rsa -in jwt.key -pubout -outform PEM -out jwt.pub
# remove the jwt.key.pub you don't need it
rm -rf jwt.key.pub
cat jwt.key
cat jwt.pub
@aprilmintacpineda
aprilmintacpineda / docs.md
Last active Nov 26, 2018
JS code speed tests
View docs.md

Looping through elements

http://jsben.ch/UgRvN

  • Accesses length property every loop.
  • Accesses length property only once and saves it into a constant.
  • Uses forEach method.

Removing an element of an array