Skip to content

Instantly share code, notes, and snippets.

View aronskaya's full-sized avatar
🥥

Julia aronskaya

🥥
View GitHub Profile
@aronskaya
aronskaya / catalyst_notes.md
Created September 3, 2019 16:51
Notes on Catalyst (macOS)

Toolbar

NSToolbar (Mac API) UIWindowScene.titlebar.toolbar — access

func scene(_ scene: UIScene,
			willConnectTo session: UISceneSession,
			options connectionOptions: 				UIScene.ConnectionOptions) {
		// setup the window
@aronskaya
aronskaya / UserDefaultsNotes.md
Last active July 8, 2019 21:00
[NSUserDefaults]

Print global NSUserDefaults:

defaults read -g

Write a date via Terminal:

defaults write [com.myapp] [theKey] -date [2019-07-08T17:08:48Z] Writes 8th of July, 2019, 17:08:48 for theKey for domain com.myapp

Nil & NSUserDefaults

Not friends. Even with NSNull. To remove a key-value pair, call removeObject:forKey:

@aronskaya
aronskaya / FDA.md
Created July 7, 2019 18:24
Notes on File System Protection on macOS on 10.14.5 (Mojave)

List of paths, protected by Full Disk Access, on 10.14.5 (Mojave):

/.Spotlight-V100
/Library/Application Support/com.apple.TCC
~/Library/Application Support/MobileSync
~Library/Application Support/CallHistoryTransactions
~Library/Application Support/com.apple.TCC
~Library/Application Support/AddressBook
~Library/Application Support/CallHistoryDB
@aronskaya
aronskaya / PDP.md
Last active March 2, 2020 17:22
Example of Personal Development Plan for iOS developers, who want to code for mac.

Personal Development Plan

Duration: 3 months

Long-term Professional Goal

Anticipate upcoming iOS and macOS platforms converging.

Short-term Professional Goal

Master development for a new platform: macOS.

@aronskaya
aronskaya / Constants.cpp
Created June 17, 2018 11:05
[Constants]
namespace Constants
{
// actual global variables
extern const double pi(3.14159);
extern const double avogadro(6.0221413e23);
extern const double my_gravity(9.2); // m/s^2 -- gravity is light on this planet
@aronskaya
aronskaya / compareFloats.cpp
Last active April 4, 2021 08:36
[Comparing floats Knuth]
#include <cmath>
// return true if the difference between a and b is less than absEpsilon (a very small number, e.g. 1e-12), or within relEpsilon percent of the larger of a and b
bool approximatelyEqualAbsRel(double a, double b, double absEpsilon, double relEpsilon)
{
// Check if the numbers are really close -- needed when comparing numbers near zero.
double diff = fabs(a - b);
if (diff <= absEpsilon)
return true;
// Otherwise fall back to Knuth's algorithm
@aronskaya
aronskaya / TISInputSource+Extensions.swift
Created May 13, 2017 10:44
[TISInputSource+Extensions] #tags: inputSource
extension TISInputSource {
var id: String {
let unsafeID = TISGetInputSourceProperty(self, kTISPropertyInputSourceID).assumingMemoryBound(to: CFString.self)
let name = Unmanaged<CFString>.fromOpaque(unsafeID).takeUnretainedValue()
return name as String
}
var type: String {
@aronskaya
aronskaya / String+Extensions.swift
Last active October 4, 2017 06:21
[String+Extensions] #string
extension String {
/// Remove all whitespaces from the string
mutating func withoutWhitespaces() {
let array = components(separatedBy: .whitespaces)
self = array.joined()
}
/// Check if a string consists only of characters from a specified ChatacterSet
func hasOnly(charsFrom charSet: CharacterSet) -> Bool {
for char in unicodeScalars {