View Playground.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
class LabelView: UIView { | |
let label = UILabel() | |
override init(frame: CGRect) { |
View iOS11CompatibleLabel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a |
View FloatLabelLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
View gist:568cdb071ea8c4688a51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void waitForResponse() | |
{ | |
signal = new CountDownLatch(1); | |
try | |
{ | |
assertTrue(signal.await(30, TimeUnit.SECONDS)); | |
} | |
catch (InterruptedException e) | |
{ | |
fail(); |
View gist:43d8396d6262a73ffbd7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="blah" > | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme" > | |
<activity | |
android:name=".HomeScreen" | |
android:label="@string/app_name" > |
View gist:822c78795f46df2571f9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.airsource.android.authtest; | |
import com.google.gson.Gson; | |
import com.google.gson.JsonElement; | |
import java.io.UnsupportedEncodingException; | |
import java.util.Map; | |
import java.util.Set; | |
import retrofit.converter.GsonConverter; |
View gist:ef9ce09fdd64f3c389fa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.airsource.android.authtest; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.util.ArrayList; | |
import java.util.List; | |
import retrofit.client.Client; | |
import retrofit.client.Header; |
View NSManagedObjectArchiving.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |