Skip to content

Instantly share code, notes, and snippets.

@bboy114crew
bboy114crew / npm_scripts_build_tool.md
Created September 19, 2021 11:27 — forked from lukewang1024/npm_scripts_build_tool.md
Notes from egghead.io course: How to Use npm Scripts as Your Build Tool

Use npm scripts as your build tool

Basic dev task composition

// Dev tasks
{
  "scripts": {
    "eslint": "eslint --cache --fix ./",
    "stylelint": "stylelint '**/*.scss' --syntax scss",
@bboy114crew
bboy114crew / uselayouteffect-ssr.md
Created September 17, 2021 15:20 — forked from gaearon/uselayouteffect-ssr.md
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@bboy114crew
bboy114crew / uselayouteffect-ssr.md
Created September 17, 2021 15:20 — forked from gaearon/uselayouteffect-ssr.md
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@bboy114crew
bboy114crew / node_nginx_ssl.md
Created September 1, 2021 13:58 — 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

@bboy114crew
bboy114crew / python_quick_tips.ipynb
Created August 16, 2021 06:17 — forked from sreeragh-ar/python_quick_tips.ipynb
Python_quick_tips.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Source: https://gist.github.com/48f44d3974db698d3127f52b6e7cd0d3
###########################################################
# Automation of Everything #
# How To Combine Argo Events, Workflows, CD, and Rollouts #
# https://youtu.be/XNXJtxkUKeY #
###########################################################
# Requirements:
# - k8s v1.19+ cluster with nginx Ingress
# Source: https://gist.github.com/764b402c8979678dfde01fd8f63c22e2
###########################################################
# Kustomize vs Helm #
# The Fight Between Templating and Patching in Kubernetes #
# https://youtu.be/ZMFYSm0ldQ0 #
###########################################################
# Links to referenced videos:
# - https://youtu.be/sUPkGChvD54
@bboy114crew
bboy114crew / Revealing-Module-Pattern.md
Created August 6, 2021 07:31 — forked from zcaceres/Revealing-Module-Pattern.md
Using the Revealing Module Pattern in Javascript

The Revealing Module Pattern in Javascript

Zach Caceres

Javascript does not have the typical 'private' and 'public' specifiers of more traditional object oriented languages like C# or Java. However, you can achieve the same effect through the clever application of Javascript's function-level scoping. The Revealing Module pattern is a design pattern for Javascript applications that elegantly solves this problem.

The central principle of the Revealing Module pattern is that all functionality and variables should be hidden unless deliberately exposed.

Let's imagine we have a music application where a musicPlayer.js file handles much of our user's experience. We need to access some methods, but shouldn't be able to mess with other methods or variables.

Using Function Scope to Create Public and Private Methods

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?