Skip to content

Instantly share code, notes, and snippets.

@carlssonk
carlssonk / coding_problems.md
Last active February 1, 2022 19:53
bigfrontend.dev coding problems with answers.

Coding problems w/ solutions

Most of these questions are taken from bigfrontend.dev. A great website for practicing JavaScript and preparing for frontend interviews.

  1. Implement curry()
function curry(fn) {
  return function curryInner(...args) {
    if (args.length >= fn.length) return fn(...args);
    return (...args2) => curryInner(...args, ...args2);
  };
@carlssonk
carlssonk / proxy_websockets.md
Last active October 25, 2021 10:02
How to reverse-proxy websockets & socket.io on NGINX

Minimal viable Nginx Configuration on how a reverse proxy for WebSockets might look like.

For WebSocket

location /websocket/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://localhost:4000; #Change 4000 to whatever port your app runs on.
}
@carlssonk
carlssonk / deploy_node_do.md
Last active February 18, 2024 16:38
Deploy node.js app to DigitalOcean

Deploy Node.js Application to DigitalOcean

This step by step tutorial will show you how to set up a Node.js server with MongoDB to DigitalOcean using PM2, NGINX as reverse proxy and a SSL from LetsEncrypt. We will also add a custom domain name.

Prerequisites

Create Droplet & Generate SSH Key