Skip to content

Instantly share code, notes, and snippets.

View PurpleBooth's full-sized avatar

Billie Thompson PurpleBooth

View GitHub Profile
@PurpleBooth
PurpleBooth / main.go
Last active August 24, 2018 12:00
hacktastic time it took a pr to get merged
package main
import (
"golang.org/x/oauth2"
"github.com/google/go-github/github"
"context"
"fmt"
"time"
"os"
"log"
@PurpleBooth
PurpleBooth / lib.rs
Last active August 10, 2018 23:18
Playing with value objects and constructors in rust (change kata)
#![cfg_attr(test, feature(plugin))]
#![cfg_attr(test, plugin(quickcheck_macros))]
extern crate core;
#[cfg(test)]
extern crate quickcheck;
use core::iter;
use std::ops::Add;
#[derive(Ord, PartialOrd, PartialEq, Eq, Debug, Clone, Copy)]
@PurpleBooth
PurpleBooth / lib.rs
Last active August 1, 2018 18:04
quickcheck games - property based testing
#![cfg_attr(test, feature(plugin))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#[cfg(test)]
extern crate quickcheck;
fn fizz_buzz(number: i32) -> String {
let mut result = String::new();
if number % 3 == 0 {
result.push_str("Fizz")
pub fn validate_commit(message: &str) -> Result<&str, &str> {
check_gap_between_subject_and_body(message)
.and_then(check_subject_line_longer_than_50_characters)
.and_then(check_body_line_longer_than_72_characters)
}
fn check_gap_between_subject_and_body(message: &str) -> Result<&str, &str> {
has_one_line(message)
.or_else(|| has_empty_second_line(message))
.ok_or("No gap between subject and body.")
@PurpleBooth
PurpleBooth / commit-msg
Last active August 2, 2018 14:09
Ensure that your pivotal tracker story ID is in your commit message using a git commit-msg hook
#!/usr/bin/env bash
# Put this in ".git/hooks/commit-msg"
# and make it executable
# chmod a+x ".git/hooks/commit-msg"
set -euo pipefail
MSG="$1"
resources:
- name: rollerderbyrss-version
type: semver
source:
driver: git
uri: git@github.com:PurpleBooth/versions.git
branch: rollerderbyrss
private_key: ((github_private_key))
initial_version: 0.3.0
# Short (50 chars or less) summary of changes
#
# More detailed explanatory text, if necessary. Wrap it to
# about 72 characters or so. In some contexts, the first
# line is treated as the subject of an email and the rest of
# the text as the body. The blank line separating the
# summary from the body is critical (unless you omit the body
# entirely); tools like rebase can get confused if you run
# the two together.
aardvark
aardwolf
Aaronite
abaction
abaculus
abaissed
abampere
Abarambo
abasedly
abatable
@PurpleBooth
PurpleBooth / Dockerfile
Last active March 21, 2024 09:33
Create a static binary in go and put it in a from scratch docker container
FROM golang:1.9
WORKDIR /go/src/github.com/purplebooth/example
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go
FROM scratch
COPY --from=0 /go/src/github.com/purplebooth/example/main /main
CMD ["/main"]
From e14992c251e1dbd1173a72c42c5ee95dc1c3711f Mon Sep 17 00:00:00 2001
From: Billie Thompson <billie@purplebooth.co.uk>
Date: Tue, 29 Aug 2017 23:22:11 +0100
Subject: [PATCH] Failing test for issue #472
---
tests/PHPStan/Analyser/NodeScopeResolverTest.php | 4 ++++
tests/PHPStan/Analyser/data/functionPhpDocs.php | 2 ++
2 files changed, 6 insertions(+)