For a list of known timezone supported in NSTimeZone, log:
[NSTimeZone knownTimeZoneNames]
The full list:
(lldb) po [NSTimeZone knownTimeZoneNames]
<__NSCFArray 0x7fba91903000>(
# rd: print recursive description of entire app window, or of a specified view | |
# | |
# usage: rd [view] | |
# | |
# if no view is specified, prints recursive description of app's keyWindow | |
# | |
command regex rd 's/^[[:space:]]*$/po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]/' 's/^(.+)$/po [%1 recursiveDescription]/' | |
# slow-on: turn slow animations on, for testing on device only, and optionally set the speed | |
# |
extension UIColor { | |
convenience init(_ hexValue: Int) { | |
let r = (hexValue & 0xFF0000) >> 16 | |
let g = (hexValue & 0x00FF00) >> 8 | |
let b = hexValue & 0x0000FF | |
self.init(red: CGFloat(r)/255, green: CGFloat(g)/255, blue: CGFloat(b)/255, alpha: 1) | |
} | |
// The basics: | |
// - Write your own NSURLProtocol subclass and register it. | |
// - Override the 5 required methods | |
// - Kick off download or cache fetch during |startLoading| | |
// - Update self.client with progress/completion/failure notifications. | |
// UIWebView will download requests concurrently via NSURLProtocol. | |
// If you use the typical NSURLCache hook to download content, you're | |
// stuck with serial downloads. |
For a list of known timezone supported in NSTimeZone, log:
[NSTimeZone knownTimeZoneNames]
The full list:
(lldb) po [NSTimeZone knownTimeZoneNames]
<__NSCFArray 0x7fba91903000>(
#define ms_invoke_block_if_not_nil(BLOCK, ...) do { typeof((BLOCK)) b = (BLOCK); if (b) b(__VA_ARGS__); } while(0) | |
// Usage: | |
void (^block)(id, id, id) = void(^)(id parameter1, id parameter2, id parameter3) { | |
// ... | |
}; | |
ms_invoke_block_if_not_nil(block, parameter1, parameter2, parameter3); | |
// As opposed to: |
function lols { | |
random_num=$RANDOM | |
let "random_num %= 20" | |
if [ $random_num -eq 0 ]; then | |
alias hg="say hg && /usr/local/bin/hg" | |
else | |
alias hg="/usr/local/bin/hg" | |
fi | |
} |
// | |
// Warnings.xcconfig | |
// | |
// The list of warnings we (don’t) use, and the reasons why. | |
// | |
// :MARK: Warnings in use: | |
// :MARK: -everything | |
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us. | |
// | |
// :MARK: - Warnings not to be promoted: |
import Cocoa | |
struct Person { | |
var name: String = "John" | |
var age: Int = 50 | |
var dutch: Bool = false | |
var address: Address? = Address(street: "Market St.") | |
} | |
struct Address { |