Skip to content

Instantly share code, notes, and snippets.

View richlloydmiles's full-sized avatar

Richard richlloydmiles

View GitHub Profile
<?xml version="1.0" encoding="utf-8" ?>
<phpunit>
<testsuite name='Hello World Test Suite'>
<directory suffix='.test.php'>./</directory>
</testsuite>
</phpunit>
<?php
function helloWorld() {
return 'hello';
}
use PHPUnit\Framework\TestCase;
class HelloWorldTest extends TestCase {
public function test_helloWorld_returns_value_as_expected() {
$this->assertEquals('hello', helloWorld());
<?php
use PHPUnit\Framework\TestCase;
class HelloWorldTest extends TestCase {
public function test_helloWorld_returns_value_as_expected() {
$this->assertEquals('hello', helloWorld());
}
}
<?php
use PHPUnit\Framework\TestCase;
class HelloWorldTest extends TestCase {}
// remove sensitive data
const hashData = (xs, y) => R.mapObjIndexed((x, key) => key.includes(y) ? '******' : x, xs);
// tests
describe('hashData', () => {
it('should hash out sensitive information as expected', async () => {
// given ... object that includes sensitive information
const sensitiveObject = {
username: 'john',
password: 'my-super-secret-password',
http://learnyouahaskell.com
Semi-Groups:
- Type with a concat method (String, Integer e.t.c by default)
e.g. "a".concat("b")
Monoid:
- Semi-group with special element that acts like a neutral identity (seen as a promotion)
- e.g would be 0 in Sum (0.Sum(anything) is anything)
- e.g would be "true" in All (true.All(anything) = is anything
- e.g. true.concat(false) === false, true.concat(true) == true)
- Some semi-groups cannot be promoted to monoids
@richlloydmiles
richlloydmiles / create.js
Last active October 20, 2018 20:50
serverless-egghead
const AWS = require('aws-sdk');
const uuid = require('uuid');
const client = new AWS.DynamoDB.DocumentClient();
modules.exports.run = async (event) => {
const data = JSON.parse(event.body);
const params = {
TableName: "todos",
Item: {
// given ...
// when ...
// then ...
## https://www.udemy.com/understanding-typescript
## playground - https://www.typescriptlang.org/play/index.html
## `tsc script.ts` - compiles ts to js