- "Libraries need to be semver"
- "Libraries need to have shallow dependencies"
- "Libraries need to protect their abstractions / not expose their internal implementation details"
I've been writing Rust full-time with a small team for over a year now. Throughout, I've lamented the lack of clear best practices around defining error types. One day, I'd love to write up my journey and enumerate the various strategies I've both seen and tried. Today is not that day.
Today, I want to reply to a blog post that almost perfectly summarised my current practice.
Go read it; I'll wait!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
set -euo pipefail | |
SOURCE=${BASH_SOURCE:-$0} | |
start_sudo_session() { | |
sudo --validate | |
while :; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPERATORS = "+-" | |
def simplify_parens(expr): | |
""" | |
Remove all unnecessary parenthesis for a simple algebra-like string. It maintains the brackets, so any operator can be swapped for any other and the resulting expression will have the same results before and after parenthesis reduction. | |
>>> simplify_parens('a') | |
'a' | |
>>> simplify_parens('a + b') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tgray: tgray.c | |
clang -g -std=c11 -Wall -framework ApplicationServices $^ -o $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=-Wall -Wextra -Werror -std=c99 -O | |
all: cycle | |
./cycle | |
cycle: cycle.c |
I hereby claim:
- I am quad on github.
- I am quad (https://keybase.io/quad) on keybase.
- I have a public key ASBxDFR1P5fGthosSBX-iUd18uAFSCpNZdqCY0yE0QaPvQo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<meta charset="utf-8" /> | |
<style> | |
body { background-color: white; margin: auto; text-align: center; } | |
p { writing-mode: vertical-rl; } | |
span { font-size: 3vh; } | |
#off { color: white }; | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import enum | |
import re | |
import sys | |
import types | |
from collections import namedtuple | |
from decimal import Decimal | |
from operator import attrgetter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing | |
import unittest | |
class TreeNode: | |
def __init__(self, left=None, right=None): | |
self.left = left | |
self.right = right | |
def is_superbalanced(self): |