Skip to content

Instantly share code, notes, and snippets.

View username0x0a's full-sized avatar
🐵
🙉 🙈 🙊

Michal Zelinka username0x0a

🐵
🙉 🙈 🙊
View GitHub Profile
@davidsteppenbeck
davidsteppenbeck / KeyframeView.swift
Created May 3, 2024 20:08
Keyframe Animation Example in SwiftUI
import SwiftUI
struct KeyframeValues {
var scale = 1.0
var horizontalStretch = 1.0
var verticalStretch = 1.0
var translation = 0.0
var rotation = Angle.zero
}
@dkun7944
dkun7944 / CDView.swift
Last active July 17, 2024 03:27
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
import AppKit
import SwiftUI
/*
Text("Menu")
.popUpMenu {
NSMenuItem(title: "One", action: nil, keyEquivalent: "")
NSMenuItem(title: "Two", action: nil, keyEquivalent: "")
}
*/
@santaklouse
santaklouse / CrossOver.sh
Last active July 24, 2024 17:46
unlimited CrossOver trial (MacOS)
#!/usr/bin/env bash
# checck if pidof exists
PIDOF="$(which pidof)"
# and if not - install it
(test "${PIDOF}" && test -f "${PIDOF}") || brew install pidof
# find app in default paths
CO_PWD=~/Applications/CrossOver.app/Contents/MacOS
test -d "${CO_PWD}" || CO_PWD=/Applications/CrossOver.app/Contents/MacOS
@saagarjha
saagarjha / remote_connection_enabler.mm
Created November 6, 2021 22:48
Enable remote connections in Quartz Debug
// If you haven't already, make sure to run this so the window list works:
// defaults write com.apple.QuartzDebug QuartzDebugPrivateInterface -bool YES
// https://gist.github.com/saagarjha/ed701e3369639410b5d5303612964557
#import "swizzler.h"
#import <AppKit/AppKit.h>
static Swizzler<void, id<NSApplicationDelegate>, NSNotification *> QuartzDebug_applicationDidFinishLaunching_ {
NSClassFromString(@"QuartzDebug"), @selector(applicationDidFinishLaunching:), [](auto self, auto notification) {
QuartzDebug_applicationDidFinishLaunching_(self, notification);
@saagarjha
saagarjha / swizzler.h
Last active December 25, 2023 18:06
Type-safe, RAII swizzler for Objective-C++
// Example usage:
// Swizzler<NSString *, NSDateFormatter *, NSDate *> NSDateFormatter_stringFromDate_ {
// NSDateFormatter.class, @selector(stringFromDate:), [&](auto self, auto date) {
// if ([NSCalendar.currentCalendar components:NSCalendarUnitWeekday fromDate:date].weekday == 4) {
// return @"It Is Wednesday My Dudes";
// } else {
// return NSDateFormatter_stringFromDate_(self, date);
// }
// }
// };
@robonxt
robonxt / Installing the Pebble app on iOS with Sideloadly.md
Last active May 21, 2024 22:09
Installing the Pebble app on iOS with Sideloadly - Rebble (Now)Official Installation Guide by robonxt

NOTICE:

This guide is now in maintenance mode. Rebble made their own official guide based on this, so please follow the updated guide on their website at help.rebble.io/sideload-ios-app. If you have any suggestions, ping me (@robonxt) or one of the helpful people in the official Rebble Discord Server and hopefully there will be a guide update soon!

Thank you for all the support, and long live Pebble and Rebble!

Fun Fact: I've never daily driven Pebble on iOS before, only to test out sideloading and to ensure the guide works with the iOS devices I have 🤣

Installing the Pebble app on iOS with Sideloadly

@zhuowei
zhuowei / safariinject.m
Last active October 22, 2021 17:15
Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
@krzyzanowskim
krzyzanowskim / StringGetSizeThatFits.swift
Last active November 12, 2023 14:51
Calculate frame of String, that fits given width
// Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop
// Licence BSD-2 clause
// Marcin Krzyzanowski marcin@krzyzanowskim.com
func getSizeThatFits(_ attributedString: NSAttributedString, maxWidth: CGFloat) -> CGSize {
let framesetter = CTFramesetterCreateWithAttributedString(attributedString)
let rectPath = CGRect(origin: .zero, size: CGSize(width: maxWidth, height: 50000))
let ctFrame = CTFramesetterCreateFrame(framesetter, CFRange(), CGPath(rect: rectPath, transform: nil), nil)
@yarshure
yarshure / iphone12_iOS_keys.txt
Created May 17, 2021 04:31
gestalt_query keys
Key Name Description
======== ===========
3GProximityCapability Whether the device has a 3G proximity sensor
3GVeniceCapability Whether the device supports FaceTime over cellular
720pPlaybackCapability Whether the device supports 720p video (identical to kMGQDeviceSupports720p)
APNCapability
ARM64ExecutionCapability Whether the device supports executing arm64 binaries
ARMV6ExecutionCapability Whether the device supports executing armv6 binaries
ARMV7ExecutionCapability Whether the device supports executing armv7 binaries
ARMV7SExecutionCapability Whether the device supports executing armv7s binaries