Skip to content

Instantly share code, notes, and snippets.

@SpacyRicochet
SpacyRicochet / CwlRandom+NWA.swift
Created August 14, 2016 10:40
Uniformly distributed random numbers for @CocoawithLove's Xoroshiro implementation
//
// CwlRandom+NWA.swift
// Butterfly
//
// Created by Bruno Scheele on 10/07/16.
// Copyright © 2016 Noodlewerk Apps V.o.f. All rights reserved.
//
import Foundation
@SpacyRicochet
SpacyRicochet / Singletons.swift
Last active August 13, 2016 17:08
Some patterns for Singletons in Swift 2
// The easiest pattern. Just use a `static let`, which gets lazy loaded as a bonus.
class Singleton {
static let sharedInstance = Singleton()
func helloWorld() {
print("Hello world")
}
}
Singleton.sharedInstance.helloWorld() // prints "Hello world"
@SpacyRicochet
SpacyRicochet / RPGMoney.playground
Created March 22, 2016 22:52
A playground messing around with Swift unit types and operators
//: Playground - noun: a place where people can play
import UIKit
protocol Money: CustomStringConvertible {
var amount: Double { get }
var inGold: Double { get }
var symbol: String { get }
}
@SpacyRicochet
SpacyRicochet / Money.swift
Last active February 9, 2019 12:13
Extension of protocol cannot have inheritance clause
protocol Money {
var value: Double { get }
var inGold: Double { get }
var symbol: String { get }
}
// Sadly, gives a compiler error.
// "Extension of protocol 'Money' cannot have an inheritance clause"
extension Money: CustomStringConvertible {
var description: String {
@SpacyRicochet
SpacyRicochet / README.md
Created February 2, 2016 11:30
Fetch 304 Test

Something to fetch

@SpacyRicochet
SpacyRicochet / Fastfile
Last active September 17, 2015 07:32
Example fastlane setup
fastlane_version "1.26.0"
lane :beta do |options|
check
end
private_lane :check do |options|
# ensure_git_status_clean
increment_build_number
@SpacyRicochet
SpacyRicochet / crash.log
Created July 19, 2015 08:11
Darkest Dungeon crash
Process: Darkest [2788]
Path: /Users/USER/Library/Application Support/Steam/*/Darkest.app/Contents/MacOS/Darkest
Identifier: com.redhookgames.Darkest
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Darkest [2788]
User ID: 501
Date/Time: 2015-07-19 10:03:08.962 +0200
@SpacyRicochet
SpacyRicochet / Crash
Created June 16, 2015 18:29
Nuclear Throne crash report 2015-06-16
Process: Mac_Runner [1509]
Path: /Users/USER/Library/Application Support/Steam/*/nuclearthrone.app/Contents/MacOS/Mac_Runner
Identifier: com.vlambeer.nuclearthrone
Version: 1.0.3 (1.0.3)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: Mac_Runner [1509]
User ID: 501
Date/Time: 2015-06-16 20:26:33.831 +0200
@SpacyRicochet
SpacyRicochet / CalendarTabImage.swift
Last active August 29, 2015 14:22
drawViewHierarchyFromRect fails to work.
extension UIImage
{
class func calendarTabImageWithCurrentDate() -> UIImage
{
return calendarTabImageWithDate(NSDate())
}
class func calendarTabImageWithDate(date: NSDate) -> UIImage
{
let dateFormatter = NSDateFormatter()
@SpacyRicochet
SpacyRicochet / Appfile
Created May 20, 2015 14:03
Fastlane setup
app_name "Some App"
for_lane "beta" do
app_identifier "com.someapp.someapp-ios.adhoc"
team_name "Some Company Ltd."
end