Skip to content

Instantly share code, notes, and snippets.

@laser
laser / run-tests-one-file.sh
Last active June 12, 2018 21:05
How to Run All Tests in a Single Go File
go test ./... \
-v \
-run "$(cat commands/foo_test.go \
| grep -oE "^func Test[^(]*" \
| sed -e "s/func //" \
| tr "\n" "|" \
| sed -e "s/|$//")"
@laser
laser / postalcodes.js
Last active June 10, 2018 22:29
postal code regular expressions
var codes = {
"AD": "AD\\d{3}",
"AM": "(37)?\\d{4}",
"AR": "([A-HJ-NP-Z])?\\d{4}([A-Z]{3})?",
"AS": "96799",
"AT": "\\d{4}",
"AU": "\\d{4}",
"AX": "22\\d{3}",
"AZ": "\\d{4}",
"BA": "\\d{5}",

Keybase proof

I hereby claim:

  • I am laser on github.
  • I am lasericus (https://keybase.io/lasericus) on keybase.
  • I have a public key ASC9zkxig-oNF8OP2GS2jTNPEW0GOVoPMIfR0WvR0buulQo

To claim this, I am signing this object:

DHT|peer-id
0|uPody
1|nGjie
2|ur5o2
3|mM69R
4|26R1S
5|jyzxZ
6|wtMS5
7|MDKez
8|t26G5
@laser
laser / pre-commit.sh
Created March 30, 2018 21:05
A Git pre-commit hook
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for FILE in $(git diff-index --name-only $against) ; do
# Check if the file contains Print
@laser
laser / iggypay.md
Last active February 21, 2018 19:39
Iggypay Atinlay

Pig Latin Translator

What is Pig Latin?

From Wikipedia:

Pig Latin is a language game or argot in which words in English are altered, usually by adding a fabricated suffix or by moving the onset or initial consonant or consonant cluster of a word to the end of the word and adding a vocalic syllable to create such a suffix. The objective is to conceal the words from others not familiar with the rules.

Basic Rules

@laser
laser / movie.md
Last active November 18, 2020 19:02

Movie Ticket Kata

First, head here to join our Zoom meeting. It will help me following along while you work through the assignment.

What Are We Building?

Write a program that calculates purchase price for movie tickets using any language you like. It should not be a full-blown web app; it can be a simple class or collection of methods invokable by your test suite. We'll provide you with some requirements, test-cases, and even a sample interface - all you have to do is give us some software.

Base Admission Rate

What's This Presentation About?

  1. Creating a Docker image containing your Rails application
  2. Using AWS CloudFormation to create an ECR repository to store your images
  3. Using AWS CloudFormation to provision an ECS cluster to which you'll deploy your app
  4. Tweaking ECS settings to affect zero-downtime deploys to cluster
  5. Executing cluster-safe database migrations

Dockerizing Your Application

@laser
laser / steps.md
Created January 23, 2018 19:43
From Zero to DB

If Running Postgres Locally

createuser --superuser --pwprompt stitchfix_owner

Set password to stitchfix_owner, as per config/database.yml

Create Stitchfix Shared Database

What’s This Presentation About?

What This Presentation Is Not

  • a deep dive into Docker
  • a comparison of Docker with other container services
  • a comparison of AWS with other PaaS and IaaS offerings

Assumptions