Skip to content

Instantly share code, notes, and snippets.

View danlourenco's full-sized avatar

Dan Lourenço danlourenco

  • Slalom _build
  • Boston, MA
View GitHub Profile
@danlourenco
danlourenco / clean_code.md
Created April 30, 2020 20:07 — 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

@danlourenco
danlourenco / CleanArchitecture.md
Created April 30, 2020 20:07 — forked from ygrenzinger/CleanArchitecture.md
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@danlourenco
danlourenco / error-handling-with-fetch.md
Created December 6, 2019 15:49 — forked from odewahn/error-handling-with-fetch.md
Processing errors with Fetch API

I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.

Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:

fetch("/api/foo")
  .then( response => {
    if (!response.ok) { throw response }
    return response.json()  //we only get here if there is no error
 })
@danlourenco
danlourenco / master-javascript-interview.md
Created October 10, 2019 18:50 — forked from Geoff-Ford/master-javascript-interview.md
Eric Elliott's Master the JavaScript Interview Series
@danlourenco
danlourenco / README.md
Created May 21, 2019 19:15 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


How to Add a DynamoDB Role to your Lambda Function

Step 1: Role Summary

@danlourenco
danlourenco / dynamic-alias.js
Created August 2, 2016 20:20 — forked from pwfisher/dynamic-alias.js
Implementation of the missing "Ember.computed.dynamicAlias"
import Ember from 'ember';
// @see http://emberjs.jsbin.com/beboga/edit?js,output
export default function dynamicAlias(target, keyKey) {
var prefix = target ? `${target}.` : '';
var dynamicAliasKey = `${prefix}${keyKey}_alias`;
return Ember.computed(function() {
var key = `${prefix}${this.get(keyKey)}`;
Ember.defineProperty(this, dynamicAliasKey, Ember.computed.alias(key));