Skip to content

Instantly share code, notes, and snippets.

@aprilmintacpineda
aprilmintacpineda / lifecycle-cheat-sheet.md
Created May 3, 2020 09:21 — forked from HyperBrain/lifecycle-cheat-sheet.md
Serverless Lifecycle Cheat Sheet

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 April 30, 2020 12:28 — forked from DavidWells/serverless.yml
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@aprilmintacpineda
aprilmintacpineda / node_nginx_ssl.md
Created February 9, 2020 12:31 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

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 January 25, 2020 04:41 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
# 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 / NodeJS require local modules resolver.md
Last active May 13, 2022 10:38
NodeJS require concept for local modules

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 / docs.md
Last active November 26, 2018 04:29
JS code speed tests

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

@aprilmintacpineda
aprilmintacpineda / Using Multiple SSH keys - Beginner Friendly.md
Last active May 6, 2024 05:32
Beginner Friendly: Using Multiple SSH keys

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?

@aprilmintacpineda
aprilmintacpineda / gist:db6239d54909ff044a45ead1bd583cc0
Created June 10, 2018 03:14 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@aprilmintacpineda
aprilmintacpineda / myscript.sh
Created May 19, 2018 13:27 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@aprilmintacpineda
aprilmintacpineda / Longest Common Substring & longest consecutive substring.md
Last active December 29, 2017 01:45
ALGORITHM: Pseudo code for `Longest Common Substring & longest consecutive substring`

Fun with strings!

Longest Common Substring & longest consecutive substring

The idea here is to get the longest common substring of two or more strings. For example, given the strings Heeeeeeeelllllloooo and teeeeeeeestoooo, it will return the string eeeeeeee, because it is the longest common string of the two.

Criteria for deciding if a string is the longest commong substring.