Skip to content

Instantly share code, notes, and snippets.

View danielpunkass's full-sized avatar

Daniel Jalkut danielpunkass

View GitHub Profile
@danielpunkass
danielpunkass / LMWindow.m
Created March 25, 2021 14:12 — forked from mittsh/LMWindow.m
How to debug your key view loop: highlights
/*
* Copyright (c) 2013 Micha Mazaheri
* Released under the MIT License: http://opensource.org/licenses/MIT
*/
#define LMWindowDEBUGResponders
#ifdef LMWindowDEBUGResponders
static BOOL _showFirstResponderOverlay = YES;
#endif
//
// UIView+RSKeyboardLayoutGuide.swift
// RSTouchUIKit
//
// Created by Daniel Jalkut on 12/23/18.
//
import UIKit
// Extends UIView to expose a keyboardLayoutGuide property that can be used to tie a view controller's content
@danielpunkass
danielpunkass / RSDimensionHuggingTextField.swift
Last active April 17, 2024 13:17
NSTextField subclasses that grow/shrink their width or height to fit text content
//
// RSDimensionHuggingTextField.swift
// RSUIKit
//
// Created by Daniel Jalkut on 6/13/18.
//
import Cocoa
// You probably want to use one of RSHeightHuggingTextField or RSWidthHuggingTextField, below
-- Line up a Python script for dynamically loading the private framework
-- and invoking the required private methods to get current grayscale mode
-- and set it to the opposite value.
set toggleGrayScript to "python -c 'from ctypes import cdll
lib = cdll.LoadLibrary(\"/System/Library/PrivateFrameworks/UniversalAccess.framework/UniversalAccess\")
lib.UAGrayscaleSetEnabled(lib.UAGrayscaleIsEnabled() == 0)
'"
do shell script toggleGrayScript
@danielpunkass
danielpunkass / gray.c
Created April 9, 2019 12:22
Standalone tool using private Apple framework to toggle display grayscale mode
#include <stdio.h>
// Compile with cc -o gray gray.c -framework UniversalAccess -F /System/Library/PrivateFrameworks
extern void UAGrayscaleSetEnabled(int isEnabled);
extern int UAGrayscaleIsEnabled();
int main() {
UAGrayscaleSetEnabled(!UAGrayscaleIsEnabled());
}
@danielpunkass
danielpunkass / xcbuild-debugging-tricks.md
Created September 14, 2018 12:42 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
Hello there
testing
Hello there
@danielpunkass
danielpunkass / ChangeKeyboard.m
Created October 6, 2015 15:47
Simple tool to change the selected input source to named keyboard...
//
// main.m
// ChangeKeyboard
//
// Created by Daniel Jalkut on 10/6/15.
// Copyright © 2015 Red Sweater. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>