Skip to content

Instantly share code, notes, and snippets.

View muescha's full-sized avatar

Muescha muescha

View GitHub Profile
muescha /
Last active February 19, 2024 02:13 — forked from JosePaumard/
This is the Countdown class used for the episode 22 of the JEP Café series
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.function.Function;
muescha / generate-slim-json-sample.rb
Last active January 9, 2024 10:16 — forked from apainintheneck/generate-slim-json-sample.rb
Testing a slimmer JSON representation for Homebrew Formula.
#!/usr/bin/env brew ruby
# Related to:
sample = Homebrew::API::Formula.all_formulae.keys.sample(25)
formulae = { Formulary.factory(_1) }
json =
json = { Homebrew::API::Formula.slim_hash(_1) }
json_string = JSON.pretty_generate(json)
outfile_path = File.expand_path("~/Desktop/slim-formula-sample.json")
File.write(outfile_path, json_string)
#!/usr/bin/env bash
ask() {
while true ; do
if [[ -z $3 ]] ; then
read -r -p "$1 [$2]: " result
read -r -p "$1 ($3) [$2]: " result
if [[ -z $result ]]; then
muescha / docs.json
Created November 21, 2022 09:58
This file has been truncated, but you can view the full file.
"Command": [],
"Constant": [
"def": "hs.configdir",
"desc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"doc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "44",
muescha / list-all-SourceNode-uniq.txt
Created July 25, 2020 19:41
list of type SourceNode created by retext-syntax-urls in the Gatsby repo
import Foundation
extension String {
func isFirstLetters(count: Int, of characterSet: CharacterSet) -> Bool {
guard characters.count >= count else {
return false
let firstLetters = substring(to: index(startIndex, offsetBy: count))
protocol LocationProtocol {
// func address() -> String
extension LocationProtocol {
enum Cities{}
muescha / IDPCastable.MD
Created January 13, 2017 05:25

i like the idea of Castable. but i don't like to have too much public functions without an "Namespace" aka Class flying around like cast, castable, match.

i prefer it more encapsulated in one class and also to prefix the first closure also with match to get it uniform with the other matches

i rewrite the class like this:


Add Encodable Protocol to an Object to create JSON ( Encodable useful in combination with Argo)

Updating rbenv Ruby to use newer OpenSSL versions

rbenv/ruby-build don’t use Homebrew-installed versions of OpenSSL — instead, they on OS X's built-in ancient version.

This can throw OpenSSL::SSL::SSLErrors when talking to websites that enforce newer SSL/TLS protocols and ciphersuites.

1: Dependencies