Skip to content

Instantly share code, notes, and snippets.

View patrickdronk's full-sized avatar
:shipit:

Patrick Dronk patrickdronk

:shipit:
View GitHub Profile
@patrickdronk
patrickdronk / clean_code.md
Created July 10, 2023 06:57 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

const axios = require('axios');
const AWS = require('aws-sdk');
const region = 'eu-west-1'; // REGION SHOULD BE LIKE (eu-west-1)
const dynamodb = new AWS.DynamoDB({ region: region, apiVersion: '2012-08-10' });
exports.handler = async ({body}) => {
const {data} = await axios.post("https://847some2lk.execute-api.eu-west-1.amazonaws.com/live/register", body);
const item = {
* startDownload(torrent, movie) {
var client = new WebTorrent();
var fileLocation = '';
client.add(torrent, {path: Helpers.publicPath() + '/movies'}, function (torrent) {
var folder = torrent.name;
var biggestSize = 0;
var location = '';
for (const key in torrent.files) {