Skip to content

Instantly share code, notes, and snippets.

@ztk37
ztk37 / postgres-compose.yml
Last active February 5, 2024 18:51
Snippets I copy around from time to time
version: "3.9"
services:
postgres:
image: postgres:alpine
container_name: postgres
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
@ztk37
ztk37 / builder.go
Last active December 1, 2020 20:37
package main
import "fmt"
type Config struct {
A string
B int
C bool
}
@ztk37
ztk37 / tree.go
Last active August 22, 2020 09:48
Golang Tree Composite
package main
import (
"fmt"
"strings"
)
type NodeType int
const (
@ztk37
ztk37 / Main.hs
Created August 10, 2020 17:02
Applicative Functors
import Data.Either
data Record = Record
{ fieldA :: String
, fieldB :: String
, fieldC :: String
} deriving (Show, Eq)
type Err = String
@ztk37
ztk37 / Data.hs
Created August 9, 2020 16:48 — forked from jproyo/Data.hs
Tagless Final Encoding in Haskell Example
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
module Data where
type UserName = String
data DataResult = DataResult String
deriving (Eq, Show)
class Monad m => Cache m where
@ztk37
ztk37 / reset.css
Created June 2, 2020 09:05 — forked from karbassi/reset.css
Modified reset.css to include useful changes from normalize.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@ztk37
ztk37 / index.js Capture DOM element screenshot using Chrome headless
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@ztk37
ztk37 / Trie.js
Created March 12, 2020 09:08 — forked from tpae/Trie.js
Trie.js - super simple JavaScript implementation
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// -----------------------------------------
// we start with the TrieNode
function TrieNode(key) {
// the "key" value will be the character in sequence
this.key = key;
@ztk37
ztk37 / cs.md
Created February 26, 2020 13:44 — forked from jeremyckahn/cs.md
Practical Computer Science Fundamentals

Practical Computer Science Fundamentals

CompSci degrees cost a lot of money, take a lot of time, and aren't a viable option for a lot of folks. Luckily, much of what you'll learn in a proper Computer Science program can be self-taught online for free. This gist is a roundup of some of the most helpful resources I've found.

Where I'm coming from

I'm not pursuing a deep, academic comprehension of CS concepts — my goal is to become respectably conversant about the most prevalent and relevant subjects in the field.

Starting points