This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question set for interviews | |
Developer | |
Tech | |
- [ ] How many projects do you have | |
- [ ] Which architectures approaches do you use | |
- [ ] Which swift version / legacy objc, c what are you going to do with it. | |
- [ ] Do you do layout in xibs or in code? | |
- [ ] What do you think about reactive programming (RxSwift) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FirebaseCoordinator { | |
static let shared = FirebaseCoordinator() | |
static let initialize: Void = { | |
/// We modify Google Firebase (and eventually Analytics) to load the mac-specific plist at runtime. | |
/// Google enforces that we have a file named "GoogleService-Info.plist" in the app resources. | |
/// This is unfortunate since we need two different files based on iOS and Mac version | |
/// One solution is a custom build step that copies in the correct file: | |
/// https://stackoverflow.com/questions/37615405/use-different-googleservice-info-plist-for-different-build-schemes | |
/// However, this is basically impossible since Catalyst doesn't set any custom build variables, so detection is extremely difficult. | |
/// We swizzle to modify the loading times. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>HKAtrialFibrillationDetectionOnboardingCompleted</key> | |
<integer>1</integer> | |
<key>HKElectrocardiogramOnboardingCompleted</key> | |
<integer>3</integer> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
<% for type in types.classes { -%> | |
<%_ if type.attributes["final"] != nil || type.attributes["open"] != nil || types.based[type.name]?.isEmpty == false { continue } -%> | |
<%_ _%>git grep -lz 'class <%= type.name %>' | xargs -0 perl -i'' -pE "s/class <%= type.name %>(?=\s|:)/final class <%= type.name %>/g" | |
<% } %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func commonSuperviews(between lhs: UIView, and rhs: UIView) -> [UIView] { | |
func getSuperviews(for view: UIView) -> [UIView] { | |
guard let superview = view.superview else { | |
return [] | |
} | |
return [superview] + getSuperviews(for: superview) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# scp-speed-test.sh | |
# | |
# Usage: | |
# ./scp-speed-test.sh user@hostname [test file size in MBs] | |
# | |
############################################################# | |
ssh_server=$1 | |
test_file=".scp-test-file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The issue with sectionHeadersPinToVisibleBounds and sectionFootersPinToVisibleBounds is that they do not pin | |
// first header and last footer when bouncing. This layout subclass fixes that. | |
class StickyLayout: UICollectionViewFlowLayout { | |
override init() { | |
super.init() | |
self.sectionFootersPinToVisibleBounds = true | |
self.sectionHeadersPinToVisibleBounds = true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
print "What is the URL of your Apple Downloads resource?\nURL:" | |
url = gets.strip | |
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: " | |
token = gets.strip | |
command = "aria2c --header \"Host: adcdownload.apple.com\" --header \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\" --header \"Upgrade-Insecure-Requests: 1\" --header \"Cookie: ADCDownloadAuth=#{token}\" --header \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1\" --header \"Accept-Language: en-us\" -x 16 -s 16 #{url} -d ~/Downloads" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The trick is to link the DeviceSupport folder from the beta to the stable version. | |
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
# (A similar approach works for older versions too, just change the version number after DeviceSupport) |
NewerOlder