This file contains hidden or 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
// Where Gradle 'project' object is the current receiver... | |
val dependencies: Map<KotlinSourceSet, Set<KotlinSourceSet>> = | |
kotlinExtension.sourceSets.associateWith { it.dependsOn } | |
val renderedDependencies = dependencies | |
.filterKeys { !it.name.endsWith("Test") } // Exclude test sourceSets | |
.filterValues { it.isNotEmpty() } // Exclude sourceSets with no relationship (e.g. meta) | |
if (renderedDependencies.isEmpty()) return@injectWriteSourceSetDotFile | |
val allRenderedSourceSets = |
This file contains hidden or 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 datasizeformatter | |
import kotlin.math.abs | |
import kotlin.math.pow | |
import kotlin.math.roundToLong | |
/** | |
* Format a human-readable representation of data size, in binary base form. | |
* e.g. 1024 -> 1 KiB | |
* @param byteCount The number of bytes to represent in human-readable form. `Long.MIN_VALUE` is unsupported. |
This file contains hidden or 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 somePackage | |
import android.content.Context | |
import android.os.Handler | |
import android.os.Looper | |
import kotlin.coroutines.experimental.* | |
var coroutineContext : CoroutineContext? = null | |
fun initCoroutines( androidContext: Context ) { |
This file contains hidden or 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 | |
final class RubberDuckyController : UIViewController { | |
@IBOutlet weak var leftButton : UIButton! | |
@IBOutlet weak var rightButton : UIButton! | |
@IBOutlet weak var textLeftButtonUnderline : UIView! | |
@IBOutlet weak var shapeRightButtonUnderline : UIView! | |
This file contains hidden or 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 | |
typealias Bough = (rotation:CGFloat, length: CGFloat, scale: CGFloat, hue: CGFloat) | |
final class TreeView : UIView { | |
private let limit = 10 | |
private let boughs : [Bough] = [ | |
(rotation: -25, length: 85, scale: 0.75, hue: 0.04), | |
(rotation: 30, length: 100, scale: 0.65, hue: 0.02) |
This file contains hidden or 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
// This compiles in both Swift 2 and 3 | |
func test1() -> Int { | |
fatalError() | |
} | |
// This compiled in Swift2 but no longer does in Swift 3 | |
let test2 : () -> Int = { | |
fatalError() | |
} |
This file contains hidden or 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 | |
protocol HTTPRequest | |
{ | |
associatedtype ResultType | |
func start( callback: (ResultType)->() ) | |
} |
This file contains hidden or 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
using System; | |
using System.Collections; | |
using UnityEngine; | |
/* | |
* Use by explicit 'this' e.g. this.Invoke( 3.0f, delegate { doSomething(); } ); | |
*/ | |
static class MonoBehaviourInvokeExtension | |
{ | |
public static void Invoke( this MonoBehaviour monoBehaviour, float delay, Action action ) |
This file contains hidden or 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
// | |
// HTTPStatus.swift | |
// | |
// Created by Chris Hatton on 17/05/2016. | |
// | |
// Transcribed from: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
// | |
import Foundation |
NewerOlder