Skip to content

Instantly share code, notes, and snippets.

old and eccentric

Shawn McCool ShawnMcCool

old and eccentric
View GitHub Profile
ShawnMcCool /
Last active Apr 23, 2021
Are named parameters a risk to all that we hold near and dear? News at 11.

This tests behavior on the process "CreateConferenceTicketsForWebinarCustomers".

It's possible to create a working test that looks like the "minimum possible" example. But the "actual" example has additional information that supplements the test. The null parameter with default values pattern is not new.

In this case, the named parameters improve the comprehensibility of the tests.

This is one of hundreds of tests that I've used this technique for. When testing various paths through the same process, being able to swap values in then given/when/then steps can be really beautiful.

View KalmanFilter.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Tabi.DataObjects;
namespace Tabi.Logic
public class KalmanLatLong : PositionEntry // Implementation taken from:
ShawnMcCool / .zshrc
Last active Jul 19, 2017
Moves the most recently modified file from the source directory to the destination directory.
View .zshrc
alias mvltr="~/scripts/"
alias ltr="ls -ltr"
ShawnMcCool / A Simple PHP Postmark
Last active Feb 21, 2017
Simple postmark email send / batching.
View A Simple PHP Postmark


public function sendSingleExample() {
    (new SendMailViaAPI('<postmark-server-token>'))->single(
        new Mail('sender name', 'sender email', 'recipient email', 'hello from exampletown', '<strong>this is bold</strong> this is not.')

public function sendBatchExample() {
ShawnMcCool /
Last active Jun 23, 2016
XRANDR Scripts for Dutch PHP Conference for 16:9 laptops
# "./" to enable 1024x768
# "./ off" to return
# This was made for a Thinkpad T450s, substitute your devices.
if [ "$1" = "off" ] ; then
echo "disabling"
xrandr --output DP2 --off
xrandr --output eDP1 --mode 1920x1080
View idiomatic-ar.php
# Discussion about idiomatic ActiveRecord usage
## Please help me to determine the idiomatic approach for creating a member and attaching an invoice ONLY IF the member doesn't already have 5 invoices.
class Member extends Eloquent {
$member = Member::create([
ShawnMcCool / gist:16cac102e06d02365403
Created Jun 17, 2015
A Sequence Collecton for C#
View gist:16cac102e06d02365403
using System.Collections.Generic;
using Infrastructure;
using NUnit.Framework;
namespace Collections {
[TestFixture] public class SeqTests {
public void can_access_the_head() {
var seq = new Seq<DomainEvent>();
var first = new TestEvent();
ShawnMcCool / php-visibility
Last active Aug 29, 2015
PHP Visibility by Example
View php-visibility
namespace PrivateExample {
class Animal {
private $innermostFeelings = "HUNGER";
public function __construct() {
echo "Animal feels $this->innermostFeelings\n";
public function empathy(Animal $other) {
ShawnMcCool / instance-reference-sugar-rfc-0.2.php
Last active Aug 29, 2015
PHP RFC: Instance Reference Sugar 0.2
View instance-reference-sugar-rfc-0.2.php
====== PHP RFC: Instance Reference Sugar ======
* Version: 0.2
* Date: 2015-03-09
* Author: Shawn McCool,
* Status: In Discussion
===== Summary =====
In order to access instance variables and methods, one must use the `$this->` prefix.
View gist:e7fea18b5695f8c499ad