Skip to content

Instantly share code, notes, and snippets.

@christianparpart
christianparpart / terminal-synchronized-output.md
Last active April 5, 2024 23:07
Terminal Spec: Synchronized Output

Synchronized Output

Synchronized output is merely implementing the feature as inspired by iTerm2 synchronized output, except that it's not using the rare DCS but rather the well known SM ? and RM ?. iTerm2 has now also adopted to use the new syntax instead of using DCS.

Semantics

When rendering the screen of the terminal, the Emulator usually iterates through each visible grid cell and renders its current state. With applications updating the screen a at higher frequency this can cause tearing.

This mode attempts to mitigate that.

@jverkoey
jverkoey / UIFont+CustomizedDynamicType.m
Created April 14, 2021 01:07
Dynamic Type system fonts with custom point sizes, weight, and italics
static const CGFloat kFontWeightEpsilon = FLT_EPSILON;
@implementation UIFont (CustomizedDynamicType)
+ (nonnull UIFont *)preferredFontWithDefaultSize:(CGFloat)size
textStyle:(nonnull UIFontTextStyle)textStyle {
return [self preferredFontWithDefaultSize:size
textStyle:textStyle
fontWeight:UIFontWeightRegular
italic:NO];
-- Based on: http://augustss.blogspot.com/2007/10/simpler-easier-in-recent-paper-simply.html
import Data.List (delete, union)
{- HLINT ignore "Eta reduce" -}
-- File mnemonics:
-- env = typing environment
-- vid = variable identifier in Bind or Var
-- br = binder variant (Lambda or Pi)
-- xyzTyp = type of xyz
-- body = body of Lambda or Pi abstraction
@fergusonm
fergusonm / gist:fb1da641246bd68275597561baa636e7
Last active September 26, 2022 08:01
Single Live Event Stream Sample
class MainViewModel : ViewModel() {
sealed class Event {
object NavigateToSettings: Event()
data class ShowSnackBar(val text: String): Event()
data class ShowToast(val text: String): Event()
}
private val eventChannel = Channel<Event>(Channel.BUFFERED)
val eventsFlow = eventChannel.receiveAsFlow()
@prologic
prologic / LearnGoIn5mins.md
Last active April 22, 2024 13:28
Learn Go in ~5mins
@msewell
msewell / AXNameFromColor.swift
Last active October 22, 2021 00:00
AXNameFromColor: String representation of a CGColor
import Accessibility
import UIKit
extension CGColor {
var rgba: String { String(format: "R: %1.3f, G: %2.3f, B: %3.3f, A: %4.3f", components![0], components![1], components![2], components![3]) }
}
let hues: ClosedRange<Int> = (0...359)
hues // with constant saturation, brightness, and alpha
@crittermike
crittermike / outline.md
Last active January 6, 2022 21:38
Difficult Conversations outline

Step 1: Prepare by Walking Through the Three Conversations

  1. Sort out What Happened.
  • Where does your story come from (information, past experiences, rules)? Theirs?
  • What impact has this situation had on you? What might their intentions have been?
  • What have you each contributed to the problem?
  1. Understand Emotions.
@cgrand
cgrand / gist:564d6e8ad57299f64beb438e4a8b709f
Created July 11, 2020 20:26 — forked from KingCode/gist:773560f4ab5bf91e660a2a26e581b036
cond-let and cond-let| macros, to leverage bindings between test and result expressions, as well as earlier ones (for cond-let)
;; (cond-let
;; (odd? x) [x n] (inc x)
;; (< n 10) [y (inc n)] 10
;; :else n))
;; we want the above to yield
;; (let [x n]
;; (if (odd? x)
;; (inc x)
@angeloskaltsikis
angeloskaltsikis / Dockerfile
Last active April 26, 2023 10:14 — forked from dmattia/terragrunt_light.js
A wrapper to make Terragrunt less verbose (both plan & apply supported). Also includes all the files required to efficiently run Terragrunt with Atlantis.
ARG atlantis_version=v0.15.0
FROM runatlantis/atlantis:${atlantis_version}
LABEL maintainer="Beat DevOps Team"
LABEL description="thebeat.co atlantis image used in IaC CI/CD!"
LABEL version="0.2"
# https://github.com/gruntwork-io/terragrunt/releases
ARG terragrunt_version=v0.25.1
@jeremy-w
jeremy-w / Project.h
Last active June 3, 2020 19:20
Rigging up versioning for iOS, the fun way
#import <UIKit/UIKit.h>
//! Project version number for Proj.
FOUNDATION_EXPORT double ProjVersionNumber;
//! Project version string for Proj.
FOUNDATION_EXPORT const unsigned char ProjVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Proj/PublicHeader.h>