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 layout.swift
// Library.swift
// LabelLayout
// Created by Chris Eidhof on 09.09.18.
// Copyright © 2018 All rights reserved.
import UIKit
shaps80 / cURL+Request.swift
Created Feb 13, 2017
Generates a cURL command representation of a URLRequest in Swift.
View cURL+Request.swift
extension URLRequest {
Returns a cURL command representation of this URL request.
public var curlString: String {
guard let url = url else { return "" }
var baseCommand = "curl \(url.absoluteString)"
if httpMethod == "HEAD" {
carsonmcdonald /
Created Jan 11, 2016
Build Swift on an Amazon Linux AMI
# Notes:
# I used the following AMI:
# "Amazon Linux AMI 2015.09.1 (HVM), SSD Volume Type - ami-60b6c60a"
# Running on AMI: amzn-ami-hvm-2015.09.1.x86_64-gp2 (ami-60b6c60a)
# You probably want to use an instance type with a large amount of memory. My first
# attempt was with a c4.2xlarge but it rant out of memory without using -j option to
# limit the parallel build.
marcboquet / gist:340c240c50aed6c71a1e
Created Aug 8, 2014
Create empty Swift playground files
View gist:340c240c50aed6c71a1e
#! /usr/bin/ruby
require 'pathname'
platform = "iphonesimulator" # or "macosx"
contents_xcplayground = <<XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='1.0' sdk='#{platform}'>
<code source-file-name='section-1.swift'/>
steventroughtonsmith / gist:6763213
Created Sep 30, 2013
Non-opaque application windows in iOS 7, with optional blur. Shows the user's wallpaper under the app, with Parallax if supported.
View gist:6763213
typedef enum _UIBackgroundStyle {
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
willurd /
Last active Dec 12, 2019
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
norio-nomura / AppDelegate.m
Created Oct 4, 2012
How to call objc_msgSendSuper()
View AppDelegate.m
// AppDelegate.m
// CallSuperMethod
#import <objc/objc-runtime.h>
#import "AppDelegate.h"
@interface Superclass : NSObject
- (NSString*)a;
mislav / easy_way.rb
Last active Aug 16, 2017
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
View easy_way.rb
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
uchida /
Created Aug 31, 2012
CUI Downloader of Command Line Tools for Xcode
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CUI Downloader of "Command Line Tools for Xcode"
# by Akihiro Uchida, CC0 dedicated to the public domain
# see
import sys, os
import urllib, urllib2, cookielib
from getpass import getpass
from HTMLParser import HTMLParser
JeffPaine /
Created Jul 10, 2012
A python list of all US state abbreviations.
states = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
You can’t perform that action at this time.