Skip to content

Instantly share code, notes, and snippets.

View zenangst's full-sized avatar
🥪
Reminiscing about vacation

Christoffer Winterkvist zenangst

🥪
Reminiscing about vacation
View GitHub Profile
@GreyAsteroid
GreyAsteroid / StageManagerOptions.md
Last active April 2, 2024 11:53
Stage Manager Options

defaults write com.apple.WindowManager GloballyEnabled -bool [True/False] Adjusts whether Stage Manager is enabled or not.

defaults write com.apple.WindowManager AutoHide -bool [True/False] Adjusts auto hide behavior. This option controls the "Show Recent Apps" and "Hide Recent Apps" GUI option.

defaults write com.apple.WindowManager AutoHideOverlapThreshold -int [-2147483647...2147483647] Unsure what this option does. Should be noted that when AutoHide is set to False and this option is set to -17 or lower Stage Manager behaves as if AutoHide is set to True.

defaults write com.apple.WindowManager LeftStripMaximumRowCount -int [-2147483647...2147483647]

// A view that can flip between its "front" and "back" side.
//
// Animation implementation based on:
// Chris Eidhof, Keyframe animations <https://gist.github.com/chriseidhof/ea0e435197f550b195bb749f4777bbf7>
import SwiftUI
// MARK: - Chris's keyframe animation design
struct Keyframe<Data: Animatable> {
//
// coredock.h
// Header file for undocumented Dock SPI
//
// Arranged by Wolfgang Baird
// Based on CoreDockPrivate.h from http://www.cocoadev.com/index.pl?DockPrefsPrivate
//
// Contributors:
// Alacatia Labs: Initial version posted at http://www.cocoadev.com/index.pl?DockPrefsPrivate
// Tony Arnold: CoreDockGetWorkspacesEnabled, CoreDockSetWorkspacesEnabled, CoreDockSetWorkspacesCount
@douglashill
douglashill / ReduceMotionScrollView.swift
Created October 21, 2018 16:10
A UIScrollView subclass that honours the reduce motion accessibility setting
// Douglas Hill, October 2018
import UIKit
/**
A scroll view that honours the reduce motion accessibility setting.
If reduce motion is enabled, animated adjustments to contentOffset
will use a cross dissolve instead of translation.
import Cocoa
var count: UInt32 = 0
let ptr = objc_copyClassList(&count)!
let strings = (0 ..< Int(count)).flatMap({
if class_getSuperclass(ptr[$0]) == nil {
return String(cString: class_getName(ptr[$0]))
} else {
@neonichu
neonichu / serve.swift
Last active April 21, 2022 17:09
Tiny HTTP server example in Swift.
#!/usr/bin/env swift
#if os(Linux)
import Glibc
let sin_zero = (UInt8(0),UInt8(0),UInt8(0),UInt8(0),UInt8(0),UInt8(0),UInt8(0),UInt8(0))
let sock_stream = Int32(SOCK_STREAM.rawValue)
#else
import Darwin.C

Update Xcode plugins to new Xcode UUID

  1. Get current Xcode UUID
XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
  1. Write it into the Plug-ins's plist
@DaveWoodCom
DaveWoodCom / fixXcode6OnElCapitan.sh
Last active September 8, 2023 21:02
Script to fix Xcode 6.x so that it will run on El Capitan
#!/bin/bash
## Copyright (C) 2015 Cerebral Gardens http://www.cerebralgardens.com/
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify,
## merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
## permit persons to whom the Software is furnished to do so, subject to the following
## conditions:
@mattt
mattt / NSDecimalNumber.swift
Last active April 1, 2023 00:06
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}
@neonichu
neonichu / implementationWithBlock.swift
Created September 29, 2014 08:17
How to use imp_implementationWithBlock in Swift
import Foundation
import ObjectiveC.runtime
let myString = "foobar" as NSString
println(myString.description)
let myBlock : @objc_block (AnyObject!) -> String = { (sself : AnyObject!) -> (String) in
"✋"
}