Author: Chris Lattner
| var cache = [Int: Int]() | |
| let queue = DispatchQueue(label: "cacheQueue", attributes: .concurrent) | |
| let iterations = 100000 | |
| // In the first run, cache is empty so we're writing each time | |
| do { | |
| let start = CFAbsoluteTimeGetCurrent() | |
| for i in 0 ... iterations { | |
| var exists = false | |
| queue.sync { |
| #use this script to get the latest version +1 of an app on hockeyapp | |
| #useful for fastlane like this appVersion = sh("sh hockeyapp_buildnumber_plus1.sh") increment_build_number( build_number: appVersion ) | |
| #requisites: jq ( https://stedolan.github.io/jq/ ) | |
| output=$(curl -s -H "X-HockeyAppToken: API_TOKEN" https://rink.hockeyapp.net/api/2/apps/APP_PUBLIC_ID/app_versions\?include_build_urls\=true\&page\=1 | jq '.app_versions[0].version' | sed "s/\"//g") | |
| echo $(($output + 1)) |
| import Foundation | |
| import UIKit | |
| /// Used to create a layout guide that pins to the top of the keyboard | |
| final class KeyboardLayoutGuide { | |
| private let notificationCenter: NotificationCenter | |
| private let bottomConstraint: NSLayoutConstraint | |
| import Foundation | |
| import UIKit | |
| import UIKit.UIGestureRecognizerSubclass | |
| /// A Gesture Recognizer that fires either on long press, or on "3D Touch" | |
| final class MNTLongPressGestureRecognizer: UILongPressGestureRecognizer { | |
| // MARK: - Properties |
| #!/bin/bash | |
| #Path to swiftlint | |
| SWIFT_LINT=/usr/local/bin/swiftlint | |
| #if $SWIFT_LINT >/dev/null 2>&1; then | |
| if [[ -e "${SWIFT_LINT}" ]]; then | |
| count=0 | |
| for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do | |
| export SCRIPT_INPUT_FILE_$count=$file_path |
Most of the manifesto is background and detailed definitions -- if you're confused or want details, read the manifesto!
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170213/032155.html
Note also that manifestos aren't complete proposals -- syntax and details may change!
One piece of background: inout is kinda complicated because it can be used on computed properties -- foo(&val.x) might be sugar for
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
| require 'set' | |
| require 'find' | |
| class Array | |
| def to_h; Hash[self]; end | |
| def to_set; Set.new(self); end | |
| def freq; group_by {|e| e }.map {|k,v| [k,v.count] }.to_h; end | |
| end |