Skip to content

Instantly share code, notes, and snippets.

@hmaurer
hmaurer / correction.md
Created September 12, 2023 09:04 — forked from GauntletWizard/correction.md
The Twelfth factor correction

The Twelfth Factor Correction

This is a series of notes on the Essay https://12factor.net/codebase

I. Codebase: One codebase tracked in revision control, many deploys

A twelve-factor app is always tracked in a version control system, such as Git, Mercurial, or Subversion. A copy of the revision tracking database is known as a code repository, often shortened to code repo or just repo.
A codebase is any single repo (in a centralized revision control system like Subversion), or any set of repos who share a root commit (in a decentralized revision control system like Git).

12 factor app specifically argues against a monorepo. Their argument is that the shared code should be refactored out into dependencies, as in Factor II. This is a valid argument, but the overhead of separating dependencies and testing them individually is not worth the cost for most small teams. The pattern of building a series of components of a distributed system from a common codebase - Of having one monorepo that produces m

#!/usr/bin/env bash
#
# A small bash wrapper to kaniko with a few assumptions built in.
set -euo pipefail
context=$1
dockerfile=$2
destination=$3
cache=true
cache_repo=$(echo "$destination" | cut -d : -f 1)-cache
@hmaurer
hmaurer / README.md
Created March 2, 2021 09:47 — forked from jocki84/README.md
scrollIntoViewIfNeeded 4 everyone!!!

Polyfill for scrollIntoViewIfNeeded()

This gist provides polyfill code for the [scrollIntoViewIfNeeded()][SIVIN] Element method found on WebKit browsers.

Features

There is no particular requirement on the position in the hierarchy of the

import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@hmaurer
hmaurer / NixOverlays.hs
Created August 8, 2020 22:04 — forked from pwm/NixOverlays.hs
Nix Overlays in Haskell
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
module NixOverlays where
import Data.Foldable (foldl')
import Data.Function (fix)
import qualified Data.HashMap.Lazy as HMap
(ns ucv.ui.pos-config.tax-master-detail
(:require
[fulcro-css.css :as css]
[fulcro.client.dom :as dom :refer [div]]
[fulcro.client.mutations :as m]
[fulcro.client.primitives :as prim :refer [defsc]]
[fulcro.client.routing :as r :refer [defsc-router]]
[fulcro.incubator.ui-state-machines :as uism :refer-macros [defstatemachine]]
[fulcro.ui.form-state :as fs]
[taoensso.timbre :as log]

Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started

Upon completion you will have a sane, productive Haskell environment adhering to best practices.

Basics

  • Haskell is a programming language.
  • Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
  • Intellij IDEA IDE is a popular IDE.

Install required libraries

sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev

@hmaurer
hmaurer / keys_plus.cljc
Created October 22, 2018 23:55 — forked from favila/keys_plus.cljc
s/keys+, an s/keys variant that allows inline respec-ing of a key to narrow the range of its type
(ns com.breezeehr.specs.keys-plus
"Variants of clojure.spec/keys and keys* that allow additional inline spec-ing."
(:refer-clojure :exclude [keys])
(:require [clojure.core :as c]
[clojure.spec.alpha :as s]
[clojure.spec.gen.alpha :as gen]
[clojure.walk :as walk])
#?(:cljs (:require-macros [com.breezeehr.specs.keys-plus]))
#?(:clj (:import (java.util UUID))))
@hmaurer
hmaurer / 0 - data.md
Created August 4, 2018 18:28 — forked from sundarj/0 - data.md
data: towards enlightenment

data

towards enlightenment

‘It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts.’

@hmaurer
hmaurer / proxychains.rb
Created June 1, 2018 21:30 — forked from allenhuang/proxychains4_formula.rb
Unofficial brew formula for proxychains 4
# Unofficial brew formula for proxychains 4
# Instruction:
# $ git clone git://gist.github.com/3792521.git gist-3792521
# $ brew install --HEAD gist-3792521/proxychains4_formula.rb
#
# The default config file will be located in /usr/local/etc/proxychains.conf
#
require 'formula'
class Proxychains < Formula