Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Konrad Feiler Bersaelor

🏠
Working from home
Block or report user

Report or block Bersaelor

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
View ShadowLabelNode.swift
// 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() }
}
@Bersaelor
Bersaelor / Matrix4+Extensions.swift
Last active May 17, 2020
Applying SCNMatrix4 to SCNVector3 (Couldn't find this in SceneKit)
View Matrix4+Extensions.swift
//
// Matrix4+Extensions.swift
// StARs
//
// Created by Konrad Feiler on 17.12.17.
// Copyright © 2017 Konrad Feiler. All rights reserved.
//
import Foundation
import SceneKit
@Bersaelor
Bersaelor / ButtonNode
Last active Dec 8, 2017
SpriteKit Node functioning as a UIButton like node
View ButtonNode
//
// ButtonNode.swift
// StARs
//
// Created by Konrad Feiler on 07.12.17.
// Copyright © 2017 Konrad Feiler. All rights reserved.
//
import SpriteKit
@Bersaelor
Bersaelor / main.swift
Created Sep 26, 2017
Example app Swift4, crashes when run on Linux environment with concurrency > 1
View main.swift
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")
@Bersaelor
Bersaelor / smoothsort.swift
Created Mar 26, 2017 — forked from kazk/smoothsort.swift
Smoothsort in Swift
View smoothsort.swift
// 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 }
@Bersaelor
Bersaelor / 0_reuse_code.js
Created Aug 22, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Bersaelor
Bersaelor / LocalizedFormatting.playground
Last active Feb 8, 2016
Demonstrates localized NSDateFormatter behaviour
View LocalizedFormatting.playground
//: 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"
View Enum with argument and rawValue
enum Fonts {
case H1
case H2
case H3
case SomethingElse(value: String)
var jsonKey: String {
switch self {
case H1:
return "H1"
You can’t perform that action at this time.