duplicates = multiple editions
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
| #!/bin/bash | |
| # requires jq | |
| # arg 1: iCloud web album URL | |
| # arg 2: folder to download into (optional) | |
| function curl_post_json { | |
| curl -sH "Content-Type: application/json" -X POST -d "@-" "$@" | |
| } |
| extension Int { | |
| func formatUsingAbbrevation () -> String { | |
| let numFormatter = NSNumberFormatter() | |
| typealias Abbrevation = (threshold:Double, divisor:Double, suffix:String) | |
| let abbreviations:[Abbrevation] = [(0, 1, ""), | |
| (1000.0, 1000.0, "K"), | |
| (100_000.0, 1_000_000.0, "M"), | |
| (100_000_000.0, 1_000_000_000.0, "B")] |
| precedencegroup BooleanPrecedence { associativity: left } | |
| infix operator ^^ : BooleanPrecedence | |
| /** | |
| Swift Logical XOR operator | |
| ``` | |
| true ^^ true // false | |
| true ^^ false // true | |
| false ^^ true // true | |
| false ^^ false // false | |
| ``` |
| -- HOWTO: | |
| -- after saving it, open with Script Editor (default) and run it | |
| -- PREREQUISITES: | |
| -- make sure your Keynote presentation is open in the background | |
| -- AFTER EXPORT: | |
| -- if you can't open the file due to encoding errors, open with Sublime (or another a text editor) and then "File / Save with encoding / UTF8" | |
| tell application "Keynote" |
| UIFont.familyNames.forEach({ familyName in | |
| let fontNames = UIFont.fontNames(forFamilyName: familyName) | |
| print(familyName, fontNames) | |
| }) |
| extension UIImage { | |
| /** | |
| Create gradient image from beginColor on top and end color at bottom | |
| - parameter beginColor: beginColor | |
| - parameter endColor: endColor | |
| - parameter frame: frame to be filled | |
| - returns: filled image | |
| */ |
| # Copyright 1999-2011 Gentoo Foundation | |
| # Distributed under the terms of the GNU General Public License v2 | |
| # | |
| # /etc/screenrc | |
| # | |
| # This is the system wide screenrc. | |
| # | |
| # You can use this file to change the default behavior of screen system wide | |
| # or copy it to ~/.screenrc and use it as a starting point for your own | |
| # settings. |
| find . -type f -name "*.swift" -not -path "./Pods/*" -exec sed -i '' -e '1,/^import/{/^\/\/.*/d;}' -e '/./,$!d' {} \; |
| extension UIView { | |
| func shake(duration: CFTimeInterval) { | |
| let translation = CAKeyframeAnimation(keyPath: "transform.translation.x"); | |
| translation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) | |
| translation.values = [-5, 5, -5, 5, -3, 3, -2, 2, 0] | |
| let rotation = CAKeyframeAnimation(keyPath: "transform.rotation.z") | |
| rotation.values = [-5, 5, -5, 5, -3, 3, -2, 2, 0].map { | |
| (let degrees: Double) -> Double in | |
| let radians: Double = (M_PI * degrees) / 180.0 |