Skip to content

Instantly share code, notes, and snippets.

View echessa's full-sized avatar

Joyce Echessa echessa

  • Nairobi, Kenya
View GitHub Profile
@echessa
echessa / System Design.md
Created April 17, 2022 16:54 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
// Set The Storage Engine
const storage = multer.diskStorage({
destination: './public/uploads/',
filename: (req, file, cb) => {
cb(null, file.fieldname + '-' + Date.now() + path.extname(file.originalname));
}
});
// Init Upload
const upload = multer({
app.post('/upload', (req, res) => {
upload(req, res, (err) => {
if (err) {
res.render('index', {
msg: err
});
} else {
if (req.file == undefined) {
res.render('index', {
msg: 'Error: No File Selected!'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<title>Upload Image</title>
const express = require('express');
const ejs = require('ejs');
// Import environmental variables from the variables.env file
require('dotenv').config({ path: 'variables.env' });
// Logger
const log = console.log.bind(console);
// Init app
[{
"duration": 12637839,
"release_day": null,
"permalink_url": "http://soundcloud.com/jwagener/sets/concerts",
"genre": null,
"permalink": "concerts",
"purchase_url": null,
"release_month": null,
"description": null,
"uri": "https://api.soundcloud.com/playlists/215461645",
@echessa
echessa / Contract Killer 3.md
Last active August 29, 2015 14:26
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post