Skip to content

Instantly share code, notes, and snippets.

View maiamcc's full-sized avatar

Maia McCormick maiamcc

View GitHub Profile

The post that prompted this:

hmm I guess I am trying to test the function more broadly. Using the database is part of testing the function or api endpoint in this case. I'm open to the idea of mocking. It's something I've never done so would be nice to learn a little about. But ideally I would like to use an actual database. Strategies for both mocking and a real database would be nice. I'm more at the stage of learning about how I could about testing these things. I essentially want to do, POST some data, I do some logic, make some db calls and I want to confirm that the state of things on the db is what I expect. Or I guess this is more accurate, I'm testing an API endpoint that happens to make some db calls. what is the difference between mock out the database and interactions with a real database?

the latter is slow and annoying and only gets slower and more annoying as your system gets more complex. Do you spin up, seed, and tear down a new database every time you want to run tests? do you have a lo

@maiamcc
maiamcc / Tiltfile-verify-context
Created February 23, 2021 17:17
Tiltfile to verify that context checking works with k8s_yaml
print("Current context is:", k8s_context())
yaml = """apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
xfile = open('advent_day1.txt')
inp= xfile.read()
# you've got a big string that's many lines of text, and each line is a number.
inp = inp.trim() # get rid of extra space on either side of the big string
lines = inp.split('\n') # make a list by splitting on every linebreak (\n is the newline character)
ints = []
for line in lines:
ints.append(int(line)) # make sure the elements in your list are numbers you can do math with, not just strings
@maiamcc
maiamcc / README.md
Created November 20, 2020 20:34
description of crossings finder

Crossings Finder

Generally speaking, theme entries are all across clues, symmetrically placed, something like this:

theme-entries-across

However, if you’re a boss, you can make it work that the theme clues are STILL symmetrical, but some across and some down. This means that they have to cross each other symmetrically, e.g:

theme-entries-crossed

@maiamcc
maiamcc / BUG.md
Created November 2, 2020 14:21
Proposed tilt issue templates

Expected Behavior

Current Behavior

Steps to Reproduce

@maiamcc
maiamcc / regexes.md
Created October 13, 2020 02:48
regexes for re-formatting spreadsheets

Start Time

=IF(H:H = "8AM-12PM","8:00 AM",
    IF(H:H = "12PM-4PM","12:00 PM",
        IF(H:H = "4PM-7:30PM","4:00 PM", 
        	IF(H:H = "AM(6:30AM-1:30PM)","6:30 AM", 
            	IF(H:H = "6:30 AM-1:30 PM","6:30 AM", 
                	IF(H:H = "PM(1:30PM-CLOSE)","1:30 PM", 
                		IF(H:H = "1:30PM-7:30PM","1:30 PM", "lolsorry")
 )
@maiamcc
maiamcc / main.go
Last active June 12, 2020 18:24
fsevents can't watch more than 4096 files (repro)
package main
import (
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/tilt-dev/fsevents"
@maiamcc
maiamcc / Dockerfile.child
Created May 18, 2020 17:28
custom build dependent images
FROM parent
RUN ["echo", "the file says:"]
RUN ["cat", "/thedate"]
@maiamcc
maiamcc / Dockerfile.child
Created May 18, 2020 17:28
custom build dependent images
FROM parent
RUN ["echo", "the file says:"]
RUN ["cat", "/thedate"]
# Description:
# First, install the Strimzi Kafka operator resources.
#
# Then apply CLUSTER_YAML which defines a Kafka custom resource; this creates the following pods:
# - cluster-kafka-0
# - cluster-zookeeper-[0-2]
# - strimzi-cluster-operator-[hash]
#
# These pods must be ready for a dependent service (stubbed out here as busybox).
#