Skip to content

Instantly share code, notes, and snippets.

ASCIIwwdc Viewing Statistics

June 1, 2014 – September 15, 2014

Percentage of total visits for sessions among the top 100 pages on ASCIIwwdc.

Initial Takeaways

  • Vast majority of views for 2014 sessions, as might be expected
  • Top 6 most-watched session all involve view controllers & Interface Builder (accounting for 1/4 of total traffic)
  • "What's New in X" sessions are extremely popular
struct Complex<T: FloatLiteralConvertible> {
var real: T
var imaginary: T
}
func +(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> {
return Complex<Double>(real: lhs.real + rhs.real, imaginary: lhs.imaginary + rhs.imaginary)
}
import CoreGraphics
infix operator |> { precedence 50 associativity left }
// MARK: CGPoint
func +(lhs: CGPoint, rhs: CGPoint) -> CGPoint {
return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}
@mattt
mattt / regex.swift
Created August 11, 2014 18:08
Creating a regular expression object from a String literal
class Regex {
let pattern: String
let options: NSRegularExpressionOptions!
private var matcher: NSRegularExpression {
return NSRegularExpression(pattern: self.pattern, options: nil, error: nil)
}
required init(pattern: String, options: NSRegularExpressionOptions = nil) {
self.pattern = pattern
static NSInteger NSJSONReadingFuckNSNulls = (1UL << 3);
@implementation NSJSONSerialization (FuckNulls)
+ (void)load {
Method originalMethod = class_getClassMethod(self, @selector(JSONObjectWithData:options:error:));
IMP swizzledImplementation = imp_implementationWithBlock([^id (id _self, NSData *_data, NSJSONReadingOptions _opt, NSError **_error){
NSInputStream *stream = [NSInputStream inputStreamWithData:_data];
[stream open];
@mattt
mattt / BCP47LanguageCodeForString.m
Last active April 21, 2018 08:45
Detect ISO 681 Language Code from String and Convert to BCP 47 Language Code
static NSString * BCP47LanguageCodeFromISO681LanguageCode(NSString *ISO681LanguageCode) {
if ([ISO681LanguageCode isEqualToString:@"ar"]) {
return @"ar-SA";
} else if ([ISO681LanguageCode hasPrefix:@"cs"]) {
return @"cs-CZ";
} else if ([ISO681LanguageCode hasPrefix:@"da"]) {
return @"da-DK";
} else if ([ISO681LanguageCode hasPrefix:@"de"]) {
return @"de-DE";
} else if ([ISO681LanguageCode hasPrefix:@"el"]) {
@mattt
mattt / Emoji.plist
Created December 30, 2013 17:26
Emoji grouped by category, as extracted by by private APIs on the iPhone simulator, via [Cédric Luthi](https://github.com/0xced).
<?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>People</key>
<array>
<string>😄</string>
<string>😃</string>
<string>😀</string>
<string>😊</string>
enum ComparisonOrdering: Int {
case Ascending = 1
case Descending = -1
case Same = 0
}
infix operator <=> { precedence 130 }
protocol CombinedComparable: Comparable, Equatable {
func <=>(lhs: Self, rhs: Self) -> ComparisonOrdering
}
struct URL {
var scheme: String?
var user: String?
var password: String?
var host: String?
var port: Int?
var path: String?
var query: String?
var fragment: String?
@mattt
mattt / alfred-wwdc.url
Last active September 25, 2018 10:01
Alfred ASCIIwwdc Web Search
alfred://customsearch/Search%20WWDC%20Sessions/wwdc/utf8/noplus/http://asciiwwdc.com/search?q={query}