Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
SRC1=$HOME/Library/Safari
SRC2=$HOME/Library/Containers/com.apple.Safari/Data/Library/Safari
HOST=$( hostname | sed 's/\..*//' )
HOUR=$( date +"%H" )
DST=$HOME/Sync/Safari/$HOST/$HOUR
mkdir -p $DST 2>/dev/null
cd $SRC1
@haikusw
haikusw / Best in Class iOS Checklist
Created July 13, 2023 20:10 — forked from DreamingInBinary/Best in Class iOS Checklist
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support
@josevazquez
josevazquez / testDecodableExtensions.swift
Created June 16, 2023 17:44
Add parse() from a json string to any Decodable
import XCTest
extension Decodable {
init(_ json: String) throws {
self = try JSONDecoder().decode(Self.self, from: json.data(using: .utf8)!)
}
}
final class DecodableExtensions: XCTestCase {
//
// ContentView.swift
// RigelianTagger
//
// Created by Berrie Kremers on 05/03/2022.
//
// This shows how a directory structure can be shown in a sidebar, with dynamic loading
// of additional content as the user drills down in the hierarchy.
//
@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);
// }
// }
// };
import Foundation
let formatter = PersonNameComponentsFormatter()
formatter.style = .long
do {
let components = formatter.personNameComponents(from: "Marcin Krzyżanowski")!
print(components.givenName!) // Marcin
print(components.familyName!) // Krzyżanowski
}
@samgrover
samgrover / newsurl.py
Created May 11, 2021 22:40
Extract URL From Apple News URL
#!/usr/bin/env python
# A helper script to convert an Apple News URL on the clipboard into
# its corresponding canonical URL and put that on the clipboard.
import pasteboard
import requests
import re
pb = pasteboard.Pasteboard()
@darwin
darwin / readme.md
Created November 16, 2020 21:59
APFS Container cloning/replicating under macOS 11.0 (Big Sur) - with a bootable system

It is the year 2020 and replicating APFS containers still sucks. One would expect it would be a simple copy and paste in the Disk Utility app but this is still far from reality.

Last year I wrote how I managed to clone my macOS system under Catalina. The main trick was to create a DMG file with multiple volumes, mount it on target machine and drop to command-line to do asr restore from synthetised disk while avoiding possible pitfalls.

The good news is that Apple devs definitely worked on improving this under Big Sur and added some documentation (see man asr). But I didn't understand it fully on first read. Maybe someone could explain how is this supposed to work?

/*:
Joe Groff:
> In a lot of the ways people use dictionaries/maps/hashtables, there's a type dependency between
> the keys and values, but most mainstream typed languages provide homogeneously-typed maps.
> Are there any that try to preserve more interesting type relationships between key and value?
> https://twitter.com/jckarter/status/1278739951568314368
> As one example, it's common for specific keys to be associated with specific types, like in
> {"name": "Tanzy", "age": 13}, "name" should always map to a string, and "age" to a number.
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 29, 2024 18:18
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support