Skip to content

Instantly share code, notes, and snippets.

View ZachOrr's full-sized avatar
🤖
TBA

Zachary Orr ZachOrr

🤖
TBA
View GitHub Profile
@ZachOrr
ZachOrr / NSCoreDataCoreSpotlightDelegate-ios-14.md
Last active December 14, 2020 18:03
Notes about the undocumented changes to NSCoreDataCoreSpotlightDelegate I've seen in iOS 14

There appears to be some undocumented changes to the NSCoreDataCoreSpotlightDelegate in iOS 14. I've been unable to find these changes documented in the NSCoreDataCoreSpotlightDelegate documentation or anywhere else online.

Debug Logging

There's quite a bit of debug logging around NSCoreDataCoreSpotlightDelegate now, including initialization and indexing requets.

Enable NSPersistentHistoryTrackingKey

NSCoreDataCoreSpotlightDelegate requires NSPersistentHistoryTrackingKey to be enabled in NSPersistentStoreDescription options. (NSInternalInconsistencyException)

Keybase proof

I hereby claim:

  • I am ZachOrr on github.
  • I am zor (https://keybase.io/zor) on keybase.
  • I have a public key whose fingerprint is 09E1 FFBE 919A 45EB 628E 5814 5B48 44C2 616E F3AF

To claim this, I am signing this object:

def match_sort_key(match):
COMP_LEVELS_PLAY_ORDER = {
'qm': 1,
'ef': 2,
'qf': 3,
'sf': 4,
'f': 5,
}
return "{}_{}".format(COMP_LEVELS_PLAY_ORDER[match['comp_level']], str(match['match_number']).zfill(3))
@ZachOrr
ZachOrr / NSManagedObject+Relationship.swift
Created March 11, 2019 01:23
Way to update sorted/unsorted NSManagedObject relationship
extension NSManagedObject {
func updateToManyRelationship<T: NSManagedObject & Managed, J: SetInitable & SetGettable>(relationship: String, newValues new: [T]?, setClass: J) {
// Store our old values so we can reference them later
let oldSet = value(forKeyPath: relationship) as? J
let oldValues = oldSet?.items as? [T]
// The ol' switcharoo
let newSet = Set(new ?? [])
setValue(J(set: newSet), forKey: relationship)
/**
* From a file that contains
* doc_id w1 w2 w3 ... lines, separated by tabs
* return an inverted index Map of w -> Set(doc_id)
*
* @param filename well isn't it obvious
* @return Map[String,Set[String]]
*/
import scala.collection.immutable.Map
server {
# listen for ipv4; this line is default and implied
listen 80;
# set your server name here
server_name zachorr.com www.zachorr.com;
# Set our root directory for our static website
root /home/zach/www;
user www-data;
# number of single-threaded process Nginx will spawn
# Set to # of CPU cores - Nginx won't benefit from anything more than that
worker_processes 4;
pid /var/run/nginx.pid;
# Number of file descriptors used for Nginx. This is set in the OS with 'ulimit -n 200000'
# or using /etc/security/limits.conf
Process: Hacky [30778]
Path: /Applications/Hacky.app/Contents/MacOS/Hacky
Identifier: com.eliasklughammer.hackernews
Version: 2.0.4 (2.0.4)
App Item ID: 584949645
App External ID: 16791934
Code Type: X86-64 (Native)
Parent Process: launchd [238]
User ID: 501
package main
import (
"fmt"
"net/http"
"regexp"
"io/ioutil"
"time"
)
package main
import "fmt"
type Rectangle struct {
length, width int
}
func (r Rectangle) Area_by_value() int {
return r.length * r.width