Skip to content

Instantly share code, notes, and snippets.

View braddle's full-sized avatar
🎯
Focusing

Mark Bradley braddle

🎯
Focusing
View GitHub Profile
@braddle
braddle / interrupt_loop.sh
Created August 17, 2023 10:54
Interruptible countdown timer
#!/bin/bash
interruptLoop() {
countdown=10
until read -s -n 1 -t 1; do
if [ $countdown -eq 0 ]; then break; fi
prefix="\033[0;34m "
if [ $countdown -lt 6 ]; then prefix="\a\033[1;35m "; fi
echo -ne "$prefix Time til next run $countdown\033[0K\r"
((countdown = countdown - 1))
@braddle
braddle / apple-silicon-fake-arch.txt
Created February 11, 2022 14:15
False Arch Solving M1 issues in docker container
docker buildx build --platform linux/amd64 -f Dockerfile . -t apple-silicon
@braddle
braddle / keybase.md
Created November 17, 2021 14:04
Keybase Proof

Keybase proof

I hereby claim:

  • I am braddle on github.
  • I am braddle (https://keybase.io/braddle) on keybase.
  • I have a public key ASD_jGYFUuS_awDxCJagjplIL2c4GP2CdceXFixHLumjBgo

To claim this, I am signing this object:

@braddle
braddle / ginkgo-file.go
Created July 24, 2019 11:17
Golang Ginkgo setup test file live template
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("$SPEC$", func() {
})
@braddle
braddle / multiply.go
Created July 17, 2019 16:16
Very simple example of testing with GoMock and Concurrency
package math
type Table struct {
Base int
Result int
}
type Random interface {
GenerateInt() int
}
@braddle
braddle / testify_suite_setup.txt
Created June 11, 2019 10:48
Golang Testify Suite SetUp Live Template
func (s *$SUITE$Suite) SetupTest() {
$END$
}
@braddle
braddle / testify_suite_test.txt
Created June 11, 2019 10:45
Golang Testify Suite Test Live Template
func (s *$SUITE$) Test$NAME$() {
$END$
}
@braddle
braddle / testify_suite.txt
Created June 11, 2019 10:01
Golang Testify Suite Live Template
type $SUITE$Suite struct {
suite.Suite
}
func Test$SUITE$Suite(t *testing.T) {
suite.Run(t, new($SUITE$Suite))
}
@braddle
braddle / tdd_talk.md
Last active January 16, 2019 21:44
Test Driven Development: Dipping your toe into tests first

Writing tests before you write production code can be an intimidating concept, but there is no need to be scared.

During this talk we will look at the concept of Test Driven Development (TDD) and what it takes to write tests first.

We will look at:

  • What is TDD?
  • Why should you use TDD?
  • How to use TDD

The talk will finish with a Mob Programming session where attendees can join in on ‘TDD-ing’ a simple piece of code.

<?php
declare(strict_types=1);
namespace Braddle\Licence;
class StubRandomNumberGenerator implements RandomNumberGenerator
{
function createRandomNumber(int $numberOfDigits): string
{
$numbers = '';