Skip to content

Instantly share code, notes, and snippets.

View au-phiware's full-sized avatar

Corin Lawson au-phiware

View GitHub Profile
@au-phiware
au-phiware / README.md
Created September 28, 2023 15:04
Go Generics: Tips, Tricks, and Pitfalls

Setting the Stage

Right off the bat, I recommend reading the official Go blog article that introduces generics, it's authoritative and to the point, which this article is neither. Instead, I want to add some colour to Go generics with a little of my personal experience.

Let's begin by talking about mocking: I have no argument that disciplined use of mocking objects is best practice, but more often than not, I am frustrated with the existing options for mocking Go interfaces. The Go ecosystem offers a surprising variety of options for generating, building, and integrating mocks into your favourite test rig. Personally, I find that they have numerous and complicated options, and cumbersome APIs. Usually they have at least one limitation, for example they don't work well with a composite of small interfaces, or dealing with high ordered functions is mind-meltingly difficult. I yearn for a mock that will simply and enthusiastically accept a function that can be tailored t

@au-phiware
au-phiware / .gitattributes
Last active November 26, 2023 22:32
mock module
go.sum -diff -merge
@au-phiware
au-phiware / vue-tests-mocha-webpack-with-coverage.md
Created September 29, 2020 03:27 — forked from lsapan/vue-tests-mocha-webpack-with-coverage.md
Setting up Vue tests (with coverage) for mocha and Webpack

Setting up Vue tests (with coverage) for mocha and Webpack

There are seemingly a few incompatibilities with Vue and Istanbul/nyc at the moment, making it a bit difficult to set up proper coverage reporting for Vue files. Thankfully, there's a relatively easy way to fix that!

This will walk you through everything you need to do to add tests and coverage reporting to your vue-cli based project.

  1. Install dependencies for testing and coverage reporting

    yarn add -D @vue/cli-plugin-unit-mocha @vue/test-utils istanbul-instrumenter-loader nyc
    
@au-phiware
au-phiware / index.html
Last active August 13, 2020 23:51 — forked from d3noob/index.html
Sankey Diagram with v4
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
# If applied, this commit will...
# Why is this change needed?
Prior to this change,
# How does it address the issue?
This change
# Provide links to any relevant tickets, articles or other resources
@au-phiware
au-phiware / .gitignore
Last active February 14, 2019 06:14
.spacemacs.d
.spacemacs.env
@au-phiware
au-phiware / vsls
Created February 4, 2019 23:49 — forked from b333z/vsls
vccode live share nixos
#!/usr/bin/env bash
# TODO: Look at nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh
# https://ms-vsliveshare.gallery.vsassets.io/_apis/public/gallery/publisher/MS-vsliveshare/extension/vsliveshare/0.3.423/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
# Dangerous:
# curl -q https://gist.githubusercontent.com/b333z/5fb902161685c5141bbc91b39a152831/raw/f65d2d0feb475b693c779eeb74fd52ca46b32916/vsls | bash
set -eu
@au-phiware
au-phiware / .dockerignore
Last active November 26, 2017 22:32
Server-side rendering of html entities.
out
node_modules
package.json
main.js
*.jar
.git
.gitignore
Dockerfile
README.md
.dockerignore
@au-phiware
au-phiware / LICENSE
Last active July 26, 2017 23:06
Transient file sharing bash client based on GPG and redis.
MIT License
Copyright (c) 2017 Corin Lawson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@au-phiware
au-phiware / notify-osd-progress.sh
Last active May 31, 2017 04:07
Example of using Notify OSD to display progress bar.
# Standard icons can be found in /usr/share/icons /usr/share/notify-osd/icons
seq 100 | while read number
do
icon=$(( ${RANDOM: -1:1} + ${RANDOM: -1:1} + 1 ))
icon=$(ls /usr/share/icons/gnome/32x32/emotes | grep face | sed s/.png// | head -n $icon | tail -n 1)
notify-send -i $icon -h int:value:$number -h string:synchronous:my-progress "Progress"
sleep 0.3
done
gdbus call --session \