Skip to content

Instantly share code, notes, and snippets.

@jwilling
jwilling / gist:4186817
Last active March 5, 2023 22:01
Lets help improve AppKit.

Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.


##NSView##

  • NSView does not have the ability to set an affine transform (rdar://15608609)
  • Controls that have cells (such as NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed. (rdar://15608822)

##NSViewController##

  • NSViewController could be more useful. It has -loadView but no other lifecycle methods. (rdar://15608948)
@gnachman
gnachman / swizzle-retain-release-autorelease
Created December 8, 2012 07:56
Swizzle retain/release/autorelease to debug busted reference counting
// Use with https://github.com/rentzsch/jrswizzle
// MIT license
// After your program dies because with a zombie, examine [theBigLog objectForKey:@"0x12345"], subbing the address of the thing that died. You can get stack traces referred to in the logs by looking up the "stack-12345" numbers in the same dict. To track a particular object, add [NSValue valueWithPointer:myobject] to debugList in a @synchronized block.
@interface ClassToDebug : NSColor
@end
@interface ClassToDebug (DebugRefs)
@end
@dodyg
dodyg / gist:5823184
Last active July 13, 2025 08:51
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@mbgearhead
mbgearhead / _brew
Created October 27, 2013 20:55
Zsh completions for phinze/homebrew-cask added to "_brew" zsh-completions file
#compdef brew
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for brew (https://github.com/mxcl/homebrew).
#
# Source: https://github.com/mxcl/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh
#
# ------------------------------------------------------------------------------
@wuhao5
wuhao5 / png_build.sh
Last active December 1, 2019 21:53
build libpng for iOS/MacOS X
rm -rf install_*
rm -rf output-*
# build simulator
./configure --prefix=`pwd`/install_i386 CFLAGS="-Ofast -mios-version-min=5.0" LDFLAGS="-flto" CC="xcrun -sdk iphonesimulator clang -arch i386"
make clean && make -j8 && make install
./configure --prefix=`pwd`/install_x86_64 CFLAGS="-Ofast -mios-version-min=5.0" LDFLAGS="-flto" CC="xcrun -sdk iphonesimulator clang -arch x86_64"
make clean && make -j8 && make install
@jspahrsummers
jspahrsummers / GHReadWriteQueue.h
Last active December 22, 2016 16:15
Non-blocking mutual exclusion with readers and writers, for asynchronous operations that may span more than one GCD block (making a single concurrent GCD queue unsuitable).
//
// GHReadWriteQueue.h
// GitHub
//
// Created by Justin Spahr-Summers on 2014-03-24.
// Copyright (c) 2014 GitHub. All rights reserved.
//
#import <Foundation/Foundation.h>
@staltz
staltz / introrx.md
Last active August 15, 2025 20:30
The introduction to Reactive Programming you've been missing
@romainl
romainl / deprecation.md
Last active February 24, 2022 02:42
Idiomatic vimrc