Skip to content

Instantly share code, notes, and snippets.

Max Howell mxcl

Block or report user

Report or block mxcl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4c3b67a344ec674b9408
This file has been truncated, but you can view the full file.
master~/src/YOLOKit$ pod trunk push YOLOKit.podspec --verbose
Validating podspec
> YOLOKit
YOLOKit (9) - Analyzing on OS X platform.
Analyzing dependencies
Fetching external sources
View PromiseKit.m
dispatch_promise(^{
return md5(email);
}).then(^(NSString *md5){
return [NSURLConnection GET:@"http://gravatar.com/%@", md5];
}).then(^(UIImage *gravatarImage){
self.imageView.image = gravatarImage;
});
View PromiseKit + YOLO?
// Trying to write a function that does some select/map magic with easy error handling
let cities = [[
"name": "Geneva",
"population": 184538
],[
"name": "Bern",
"population": 123154
], [
"name": "Zurich",
View gist:e83aa653da7fec6f3ce4
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]!, error: NSError!) in
if error == nil {
self.latitudeArray = objects.map{ $0["latitude"]! as Double }
} else {
println(error)
}
}
View BlurryVC.swift
import UIKit
class BlurryVC: UIViewController {
override func loadView() {
view = UIVisualEffectView(effect: UIBlurEffect(style: .Light))
}
}
class ViewController: UIViewController {
View XMPPFramework.podspec.json
{
"name": "XMPPFramework",
"version": "3.6.4",
"platforms": {
"ios": "5.0",
"osx": "10.7"
},
"license": {
"type": "BSD",
"file": "copying.txt"
View mergesort.swift
import Darwin //.C.stdlib
// updated for Swift 2.0 beta4
private func merge<T: Comparable>(a: ArraySlice<T>, _ b: ArraySlice<T>, mergeInto acc: ArraySlice<T> = []) -> ArraySlice<T> {
guard let aF = a.first, bF = b.first else {
return acc + a + b
}
return aF < bF
? merge(dropFirst(a), b, mergeInto: acc + [aF])
View pmk-swift2.swift
firstly {
NSURLSession.GET(url)
}.then { (dict: NSDictionary) in
//
}.catch { (err: Error.JSONError) in
// The token `JSONError` is defined in PromiseKit
}.catch { (err: Error.HTTPError) in
switch err.statusCode {
case 400: //
//
@mxcl
mxcl / .profile
Created Apr 22, 2009
My Bash .profile file
View .profile
#!/bin/bash
alias ..="cd .."
alias ls="ls -p"
alias la="ls -lA"
alias l="ls -l"
alias ll="ls -l"
alias psf="ps -cU `whoami`"
alias grep="grep --color=auto"
alias cack="ack --cpp"
@mxcl
mxcl / flac2mp3.md
Created Jun 5, 2009
Simplest functional FLAC to MP3 converter script you can make
You can’t perform that action at this time.