Author: Chris Lattner
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
// | |
// NSApplication+NSResponderDebug.swift | |
// | |
// Created by Stephan Casas on 3/18/24. | |
// | |
import Cocoa; | |
extension NSApplication { | |
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
// | |
// View+WindowGeometryPreferences.swift | |
// | |
// Created by Drew Olbrich on 1/30/24. | |
// Copyright © 2024 Lunar Skydiving LLC. All rights reserved. | |
// | |
// MIT License | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
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/bash | |
# Delete Archived Applications | |
rm -r ~/Library/Developer/Xcode/Archives/*/ | |
# Delete Devired Data | |
rm -r ~/Library/Developer/Xcode/DerivedData/*/ | |
# Delete Apple cached files | |
rm -r ~/Library/Developer/CoreSimulator/Caches/dyld/*/*/ |
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
// known-good: Swift 4.2, macOS | |
import Foundation | |
import ModelIO | |
private func LogDebug(_ s:Any) -> Void { print(s) } | |
private func LogInfo(_ s:Any) -> Void { print(s) } | |
private func LogError(_ s:Any) -> Void { print(s) } | |
struct POINT3D { | |
var x:Float |
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
// Note that this checker is always running, even when the app is in the background (where it doesn't matter if the main thread is blocked) | |
// You'll have to add more code if you don't want the checker to run while the app is in the background | |
final class ANRChecker { | |
private let ANRThreshold: CFTimeInterval = 5 | |
// This variable may be accessed from multiple threads at the same time. It won't cause issues, but if you want prevent the thread sanitizer from complaining, you can add locking around it or w/e | |
private lazy var lastResponseTime: CFTimeInterval = CACurrentMediaTime() | |
func beginChecking() { | |
updateLastResponseTime() |
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
''' | |
Break on Objective-C 's method using its address' | |
''' | |
import shlex | |
import lldb | |
import re | |
def breakonmethod(debugger, command, exe_ctx,result, internal_dict): | |
args=shlex.split(command) | |
Class=args[0] | |
Method=args[1] |
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
const char fragmentShader_yuv420p[] = | |
{ | |
"precision mediump float;\n" | |
"uniform sampler2D Ytex;\n" | |
"uniform sampler2D Utex,Vtex;\n" | |
"varying vec2 vTextureCoord;\n" | |
"void main(void) {\n" | |
" float nx,ny,r,g,b,y,u,v;\n" | |
" mediump vec4 txl,ux,vx;" | |
" nx=vTextureCoord[0];\n" |
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
private func createDisplayLink() { | |
CVDisplayLinkCreateWithActiveCGDisplays(&displayLink) | |
guard let displayLink = displayLink else { | |
return | |
} | |
let callback: CVDisplayLinkOutputCallback = { (_, _, _, _, _, userInfo) -> CVReturn in | |
let myView = Unmanaged<MyView>.fromOpaque(COpaquePointer(userInfo)).takeUnretainedValue() | |
dispatch_async(dispatch_get_main_queue()) { | |
myView.update() |
NewerOlder