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
// based on objective-c code Erica Sadun: https://github.com/erica/useful-things | |
import SpriteKit | |
fileprivate let shadowEffectNodeKey = "ShadowEffectNodeKey" | |
class ShadowLabelNode: SKLabelNode { | |
var offset : CGPoint = CGPoint(x: 1, y: -1) { | |
didSet { updateShadow() } | |
} |
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
// | |
// Matrix4+Extensions.swift | |
// StARs | |
// | |
// Created by Konrad Feiler on 17.12.17. | |
// Copyright © 2017 Konrad Feiler. All rights reserved. | |
// | |
import Foundation | |
import SceneKit |
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 | |
import Dispatch | |
guard CommandLine.arguments.count > 1 else { | |
print("Please add one argument for the number of lanes") | |
exit(0) | |
} | |
var maxConcurrency = Int(CommandLine.arguments[1]) ?? 1 | |
print("Starting to fetch with max \(maxConcurrency) simultaneous fetches") |
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
// Swift3 adaption of https://gist.github.com/kazk/5c660d071642193f5301 by https://github.com/kazk | |
// An implementation of [Smoothsort] algorithm invented by Edsger Dijkstra, | |
// which I didn't get until reading [Smoothsort Demystified] by Keith Schwarz. | |
// | |
// Some optimizations like the chained swaps and corner case elimination were | |
// derived from [smoothsort.c] by Martin Knoblauch Revuelta. | |
func smoothsort<T : Comparable>( a: inout [T]) { | |
smoothsort(&a) { $0 < $1 } |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
let date = NSDate() | |
let number = 29.23 | |
let heightInm = 1.87 | |
let dateFormatter = NSDateFormatter() | |
dateFormatter.dateFormat = "yyyy" |
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
enum Fonts { | |
case H1 | |
case H2 | |
case H3 | |
case SomethingElse(value: String) | |
var jsonKey: String { | |
switch self { | |
case H1: | |
return "H1" |