Skip to content

Instantly share code, notes, and snippets.

View mateuspiresl's full-sized avatar

Mateus Pires mateuspiresl

View GitHub Profile
@gniemann
gniemann / unit_testing.md
Created January 19, 2020 18:11
Review of "Unit Testing Principles, Practices, and Patterns"

Last month, I read "Unit Testing Principles, Practices, and Patterns" by Vladimir Khorikov. This is a short collection of my thoughts on this work.

Overall, I found the book to be the best intermediate to advanced works on testing that I have read. This is not your 'typical' unit testing book that first tries to convince you that testing is important, than walks you through how to create very rudimentry unit tests. Neither does it expose a particular development practice like TDD. Rather, Khorikov starts with the premise that you already see the value in testing and are already writing tests. The goal of the book is to help you write better, more useful tests by identifying the attributes of a good test. As a developer recogonizes and understands the attributes of a good test suite and how to write one, they begin to write better, more testable code, creating a virtuious cycle in the codebase.

Khorikov's big idea comes in chapter 4, after he has described the st

@santisbon
santisbon / XMLHttpRequestLoadImagePromise.js
Last active August 16, 2023 19:00
Using XMLHttpRequest to load an image in a #javascript #promise. Based on Mozilla Developer Network documentation.
/*jslint devel: true, browser: true, es5: true */
/*global Promise */
function imgLoad(url) {
'use strict';
// Create new promise with the Promise() constructor;
// This has as its argument a function with two parameters, resolve and reject
return new Promise(function (resolve, reject) {
// Standard XHR to load an image
var request = new XMLHttpRequest();
@smebberson
smebberson / .gitignore
Created January 9, 2012 06:46
Express simple authentication example
node_modules
*.swp