Skip to content

Instantly share code, notes, and snippets.

View jeanetienne's full-sized avatar

Jean-Étienne jeanetienne

View GitHub Profile
@jeanetienne
jeanetienne / keybase.md
Created March 3, 2024 11:16
Keybase Proof

Keybase proof

I hereby claim:

  • I am jeanetienne on github.
  • I am jeanetienne (https://keybase.io/jeanetienne) on keybase.
  • I have a public key ASDvZWeP42F_TBBFEtbHUWLzs2GEjt1f6ID8anrvNHG63Qo

To claim this, I am signing this object:

//
// Some styling architecture
//
class DefaultTheme {
enum Color {
static let primary: UIColor = .white
static let secondary: UIColor = .gray
}
//
// More type-aware convenience functions for registering and dequeueing cells
//
import UIKit
fileprivate extension UICollectionViewCell {
static var defaultReuseIdentifier: String {
return String(describing: self)
//
// Logic necessary to implement a "closing handler" for a NSDocument
//
// This is inspired by:
// - https://stackoverflow.com/questions/49343307/best-practice-to-implement-canclosewithdelegateshouldclosecontextinfo
// - https://github.com/keith/radars/blob/master/NSDocumentSwiftAnnotations/NSDocumentSwiftAnnotations/Document.swift
// Keith's supporting documentation for his radar submission: http://www.openradar.me/33422662
// Documentation:
// - https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/
// Paragraph called: "Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern"
@jeanetienne
jeanetienne / NSImage+RoundedCorners.swift
Last active January 18, 2024 21:28
Drawing an NSImage with rounded corners in Swift
// This extension is a port of @venj's solution from 2011
// https://github.com/venj/Cocoa-blog-code/blob/master/Round%20Corner%20Image/Round%20Corner%20Image/NSImage%2BRoundCorner.m
extension NSImage {
func roundCorners(withRadius radius: CGFloat) -> NSImage {
let rect = NSRect(origin: NSPoint.zero, size: size)
if
let cgImage = self.cgImage,
let context = CGContext(data: nil,
# For Homebrew (brew.sh)
set -x PATH "/usr/local/bin:$PATH"
# For Cask (caskroom.io)
set -x HOMEBREW_CASK_OPTS "--caskroom=~/Documents/Caskroom --appdir=~/Applications"
# Make TextMate the default editor
set -x EDITOR "/usr/local/bin/mate -w"
@jeanetienne
jeanetienne / init.lua
Created February 3, 2016 22:38
Config for hammerspoon
local alertDuration = 0.35
local log = hs.logger.new('jeanetienne','debug')
-- Reload the config
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function()
hs.reload()
hs.alert.show("Config loaded", 1)
end)
-- Resizing windows