As of macOS 12 (Monterey), Apple's Virtualization framework has nice support for macOS guest virtual machines, but with severe limitations: For example you can't install a macOS guest on Intel Macs, install guests with newer versions of macOS than the host, copy and paste between the host and the guest, or install third party kernel extensions in the guest. As usual for Apple, the functionality they do support is nicely implemented, but they've left out so much that the result is only marginally useful -- at least compared to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let overrideCatalystScaleFactor: Void = { | |
guard let sceneViewClass = NSClassFromString("UINSSceneView") as? NSObject.Type else { | |
return | |
} | |
if sceneViewClass.instancesRespond(to: NSSelectorFromString("scaleFactor")) { | |
// old | |
swizzleInstanceMethod( | |
class: sceneViewClass, | |
originalSelector: NSSelectorFromString("scaleFactor"), | |
swizzledSelector: #selector(swizzle_scaleFactor) |
Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.
Informative DevForum posts from everyone's favorite DTS member.
(Arranged newest to oldest)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RMS NOTATION TUTORIAL | |
BEHAVIOR | |
=: write-only | |
+: read/writeable | |
&: earlyclobber (impacts register sharing, defensive copying, etc.) | |
%: commutative | |
,: groups alternative constraints | |
?: discourages group of constraints |
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]
struct foo {
struct bar {
int x;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dynamic library that pauses a short lived program during launch so that a | |
// debugger can attach to it. To use it, compile it on macOS: | |
// clang -dynamiclib pause4debug.c -o pause4debug.dylib | |
// On Linux: | |
// gcc -shared -fPIC pause4debug.c -o pause4debug.so | |
// To use it, make the dynamic linker inject it using DYLD_INSERT_LIBRARIES or | |
// LD_PRELOAD, depending on your platform. On macOS: | |
// DYLD_INSERT_LIBRARIES=/path/to/pause4debug.dylib debugme | |
// On Linux, | |
// LD_PRELOAD=/path/to/pause4debug.so debugme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd() { | |
# Set the current directory to the 0th history item | |
cd_history[0]=$PWD | |
if [[ $1 == -h ]]; then | |
for i in ${!cd_history[@]}; do | |
echo $i: "${cd_history[$i]}" | |
done | |
return | |
elif [[ $1 =~ ^-[0-9]+ ]]; then | |
builtin cd "${cd_history[${1//-}]}" || # Remove the argument's dash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UICollectionView Objective-C example | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
if (selectedIndexPath != nil) { | |
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
if (coordinator != nil) { | |
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postUpdatedxkcdIfNecessary() { | |
var properties = PropertiesService.getUserProperties(); | |
var latestComic = JSON.parse(UrlFetchApp.fetch("http://xkcd.com/info.0.json").getContentText()); | |
if (latestComic["num"] > properties.getProperty("lastComic")) { | |
var title = latestComic["title"]; | |
var imageURL = latestComic["img"]; | |
var altText = latestComic["alt"]; | |
var number = latestComic["num"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# == 1 ]; then | |
git fetch origin pull/$1/head:pr-$1 | |
git checkout pr-$1 | |
elif [ $# == 2 ]; then | |
git fetch $1 pull/$2/head:pr-$2 | |
git checkout pr-$2 | |
else | |
echo "Usage: git test-pr [remote] pr#" |
NewerOlder