Skip to content

Instantly share code, notes, and snippets.

View dezinezync's full-sized avatar
🏠
Working from home

Nikhil Nigade dezinezync

🏠
Working from home
View GitHub Profile
@lukaskubanek
lukaskubanek / NSView Drawing Issue on macOS Big Sur.md
Last active July 18, 2022 08:09
NSView Drawing Issue on macOS Big Sur

This is an excerpt from our internal documentation describing an issue with drawing in NSViews on macOS Big Sur.

1️⃣ Introduction

In macOS Big Sur (probably starting with β9), Apple changed the default contents format for backing layers of NSViews. Instead of an explicit CALayerContentsFormat.RGBA8Uint value, an „Automatic“ value is now used. Even though it also resolves into „RGBA8“ in our testing, it has some serious implications as it breaks assumptions our code relies on.

I first stumbled upon this issue in this tweet by Frank. It links to a thread on Apple Forums by Mark that contains valuable information as well as ideas for workarounds. The changed behavior was also confirmed by Marcin in this tweet.

2️⃣ Impact on Diagrams

@cdevroe
cdevroe / PhotographyBlogs.opml
Last active September 15, 2020 11:41
An OPML file of Photography related blogs - Inspired by Jim Grey
<?xml version="1.0" encoding="UTF-8"?>
<!-- OPML generated by NetNewsWire -->
<opml version="1.1">
<head>
<title>PhotographyBlogs.opml</title>
</head>
<body>
<outline text="Photography" title="Photography">
<outline text="Colin Devroe" title="Colin Devroe" description="" type="rss" version="RSS" htmlUrl="http://cdevroe.com/" xmlUrl="http://cdevroe.com/feed/"/>
<outline text="Christopher May Fine Art Photography" title="Christopher May Fine Art Photography" description="" type="rss" version="RSS" htmlUrl="https://christophermayphotography.com/" xmlUrl="https://christophermayphotography.com/feed/"/>
//
// ContentView.swift
//
//
// Created by Bernstein, Joel on 7/4/20.
//
import SwiftUI
struct ElementModel: Identifiable
@douglashill
douglashill / FourColumns.swift
Created June 23, 2020 21:05
A sample UIKit app that sets up a four column layout with new iOS 14 API on UISplitViewController.
import UIKit
class FourColumnsContainerViewController: UIViewController {
let outerSplitViewController = UISplitViewController(style: .tripleColumn)
let innerSplitViewController = UISplitViewController(style: .doubleColumn)
let primary = makeContentViewController("App")
let secondary = makeContentViewController("Files")
let mainContent = makeContentViewController("File Content")
let inspector = makeContentViewController("Inspector")
@steipete
steipete / UIWindow+PSPDFAdditions.h
Last active June 5, 2024 20:09
Mac Catalyst: Get the NSWindow from a UIWindow (Updated for macOS 11 Big Sur, also works with Catalina)
// Don't forget to prefix your category!
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIWindow (PSPDFAdditions)
#if TARGET_OS_UIKITFORMAC
@tylerhall
tylerhall / OutlineViewController+Extension.m
Created April 24, 2019 20:44
NSOutlineView Drag and Drop with Core Data
- (void)outlineViewItemDidCollapse:(NSNotification *)notification {
VirtualHost *vh = [[[notification userInfo] valueForKey:@"NSObject"] representedObject];
vh.isExpandedValue = NO;
}
- (void)outlineViewItemDidExpand:(NSNotification *)notification {
VirtualHost *vh = [[[notification userInfo] valueForKey:@"NSObject"] representedObject];
vh.isExpandedValue = YES;
}
</code></pre>
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
@zulhfreelancer
zulhfreelancer / zsh.md
Last active March 21, 2020 05:28 — forked from tsabat/zsh.md
How to install zsh in Ubuntu 16 on EC2

Prereq:

If you want to change the hostname, follow this guide.

sudo apt update -y && sudo apt install -y zsh git-core

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

@mrugeshtank
mrugeshtank / HapticHelper.Swift
Last active April 2, 2021 06:43
Haptic feedback generator class
import UIKit
class HapticHelper {
enum HapticType {
case impactLight
case impactMedium
case impactHeavy
case selectionChange
case notificationSuccess
case notificationError
@dionc
dionc / MapKitExtensions.swift
Last active September 21, 2024 10:17
Create an MKCoordinateRegion from an array of coordinates. Safely handles coordinates that cross the 180th meridian.
import MapKit
extension MKCoordinateRegion {
init?(coordinates: [CLLocationCoordinate2D]) {
// first create a region centered around the prime meridian
let primeRegion = MKCoordinateRegion.region(for: coordinates, transform: { $0 }, inverseTransform: { $0 })
// next create a region centered around the 180th meridian