Skip to content

Instantly share code, notes, and snippets.

View moonmaster9000's full-sized avatar

moonmaster9000 moonmaster9000

View GitHub Profile
function RPS(){
this.play = function(p1, p2, ui){
new PlayUseCase(p1, p2, ui).execute()
}
}
function PlayUseCase(p1, p2, ui){
this.execute = function(){
if (inputInvalid()){
ui.invalid()
@moonmaster9000
moonmaster9000 / test_double_cheat_sheet.md
Created April 19, 2017 20:37
Test Double Cheat Sheet

Test Doubles

There are five types:

  • Dummy
  • Stub
  • Spy
  • Mock
  • Fake

React Cheat Sheet

Getting started with React is simple. There's only three things you need to know to get started: Components, props, and state.

Components

Components are the basic building blocks of a react app. They have a render method:

const React = require("react")
@moonmaster9000
moonmaster9000 / javascriptClasses_es6_versus_es5.js
Last active August 13, 2019 17:13
Javascript Classes: es5 versus es6
//old school es5 syntax for creating a class
//advantage: lets you create private functions and state through closure
//disadvantage: looks weird if you learned OO through language like c++/java/ruby, etc. Doesn't support prototypical inheritance.
//constructor function
function MyES5Class(aPrivateVar){
var aontherPrivateVar = "I'm a private variable! You can't access me from the outside."
this.publicVar = "I'm a public variable! You can access me from the outside!"
this.myPublicFunction = function(){