Skip to content

Instantly share code, notes, and snippets.

Sam Duke samskiter

  • Cambridge, UK
Block or report user

Report or block samskiter

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
samskiter / Playground.swift
Created Jan 11, 2018
A playground demonstrating an issue with UILabel's intrinsic content size
View Playground.swift
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class LabelView: UIView {
let label = UILabel()
override init(frame: CGRect) {
samskiter / iOS11CompatibleLabel.swift
Last active Jan 12, 2018
A UILabel subclass that detects and attempts to fix intrinsicContentSize bugs in UILabel on iOS 11
View iOS11CompatibleLabel.swift
import UIKit
/// A UILabel subclass that detects and attempts to fix intrinsicContentSize bugs in UILabel
class iOS11CompatibleLabel: UILabel {
override var intrinsicContentSize: CGSize {
// First attempt at a fix...
// All UILabels that misbehave have numberOfLines==0 and preferredMaxLayoutWidth=0
// but all UILabels that have these two properties as 0 do not necessarily misbehave
samskiter / a
Created Feb 20, 2017
Broken preservesSuperviewLayoutMargins
* Copyright 2014 Chris Banes
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
View gist:568cdb071ea8c4688a51
private void waitForResponse()
signal = new CountDownLatch(1);
assertTrue(signal.await(30, TimeUnit.SECONDS));
catch (InterruptedException e)
View gist:43d8396d6262a73ffbd7
<manifest xmlns:android=""
package="blah" >
android:theme="@style/AppTheme" >
android:label="@string/app_name" >
samskiter / gist:822c78795f46df2571f9
Last active Aug 29, 2015
Url encode requests from GSON objects :)
View gist:822c78795f46df2571f9
import java.util.Map;
import java.util.Set;
import retrofit.converter.GsonConverter;
samskiter / gist:ef9ce09fdd64f3c389fa
Created Jan 29, 2015
First cut of Google-http-client retrofitting
View gist:ef9ce09fdd64f3c389fa
import java.util.ArrayList;
import java.util.List;
import retrofit.client.Client;
import retrofit.client.Header;
View NSManagedObjectArchiving.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface NSManagedObjectArchiver : NSObject
* Takes a NSManagedObject and converts it to a NSData archive - it traverses all relationships ( including circular ) and archives it
+ (NSData *)archivedDataWithRootObject:(NSManagedObject *)pObject;
You can’t perform that action at this time.