Skip to content

Instantly share code, notes, and snippets.

View row1's full-sized avatar

Rowan row1

View GitHub Profile
@row1
row1 / contrived-pure-function-example.js
Created November 18, 2017 02:24
A contrived example showing the difference between pure and impure functions.
class ImpureCalc {
constructor() {
this.currentTotal = 0;
}
addToTotal(valueToAdd) {
this.currentTotal += valueToAdd;
return this.currentTotal;
}
}
var request = require("request"),
jsdom = require("jsdom"),
$ = require("jquery")(jsdom.jsdom().createWindow()),
http = require('http');
var options = {
uri: "http://en.wikipedia.org/wiki/List_of_PlayStation_Vita_games",
method: "GET"
};
@row1
row1 / _testbootstrap.php
Last active August 25, 2020 16:17
Joomla PHPUnit Bootstrap
<?php
//TODO: Change this to match your path
$pathToJoomla = "/Applications/MAMP/htdocs/joomla32";
if (!is_dir(realpath($pathToJoomla))) {
throw new Exception("Could not find the folder: $pathToJoomla");
}
//Fake some required variables