Version: 2022.03.02
This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.
| Description | Syntax |
|---|---|
| Get the length of a string | ${#VARNAME} |
| Get a single character | ${VARNAME[index]} |
Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.
If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.
- macOS 10.15.5
- tmux 3.1b
macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.
Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):
| import cats.effect.{ContextShift, IO, Resource, Timer} | |
| import com.twitter.finagle.{Http, ListeningServer, Service} | |
| import com.twitter.finagle.http.{Request, Response} | |
| import com.twitter.server.TwitterServer | |
| import com.twitter.util.Future | |
| import io.finch.Endpoint | |
| import io.finch.internal.ToEffect | |
| import java.util.concurrent.CountDownLatch | |
| import scala.concurrent.ExecutionContext |
After installing the keybase command-line tool onto a new / fresh computer, you may want to import your PGP key to the local keyring so that you may use the keys with GPG.
Import your PUBLIC PGP key:
keybase pgp export|gpg --import -| case class Food(ingredients: Seq[String]) | |
| class Chef[Pizza <: Chef.Pizza] protected (ingredients: Seq[String]) { | |
| import Chef.Pizza._ | |
| def addCheese(cheeseType: String): Chef[Pizza with Cheese] = Chef(ingredients :+ cheeseType) | |
| def addTopping(toppingType: String): Chef[Pizza with Topping] = Chef(ingredients :+ toppingType) | |
| def addDough: Chef[Pizza with Dough] = Chef(ingredients :+ "dough") |
Historically, Finch's error handling machinery was built on a very simple yet silly idea that an Endpoint may return a failed Future (i.e., Future.exception). While that doesn't really promote a purely functional approach to error handling (i.e., treat errors as values), it enables quite a few handy setups, including:
- embedding 3rd-party Finagle clients (that may fail) within endpoints w/o extra boilerplate
- simple/minimal required endpoints (i.e.,
body,param, etc) that returnA, notTry[A]norEither[Error, A]
However this part of Finch's design was heavily influenced by Finagle itself (w.r.t. embedding all of its failures in Future.exception), nothing stops us from revisiting this trade-off and possibly discussing paths forward more idiomatic error handling.
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
| # Linux | |
| # add the following to "~/.gitconfig" file | |
| [merge] | |
| tool = intellij | |
| [mergetool "intellij"] | |
| cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED") | |
| trustExitCode = true | |
| [diff] |