Skip to content

Instantly share code, notes, and snippets.

View magnuskahr's full-sized avatar

Magnus Kahr Jensen magnuskahr

View GitHub Profile
@magnuskahr
magnuskahr / IntegerField.swift
Created August 2, 2021 18:54
An integer field in swiftui
struct IntegerField: View {
@Binding var value: Int
@State private var stringValue: String
init(value binding: Binding<Int>) {
self._value = binding
self._stringValue = State(wrappedValue: binding.wrappedValue.formatted())
}
@magnuskahr
magnuskahr / AnimateableView.swift
Created May 13, 2021 21:21
Rolling animatable view
struct AnimateableView<ContentView: View, Value: VectorArithmetic>: View {
let value: Value
@ViewBuilder let builder: (Value) -> ContentView
var body: some View {
builder(value)
.modifier(Animation<ContentView, Value>(value: value, builder: builder))
}
import UIKit
import QuartzCore
class ConfettiView: UIView {
public var colors: [UIColor]!
public var intensity: Float!
private(set) var active: Bool!
override public class var layerClass: Swift.AnyClass {
@magnuskahr
magnuskahr / bingo-python.ipynb
Created December 13, 2019 13:10
Bingo Ticket Isolation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@magnuskahr
magnuskahr / untitled8.ipynb
Last active December 6, 2019 14:56
Untitled8.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@magnuskahr
magnuskahr / projectbook.ipynb
Last active November 25, 2019 21:05
projectbook_v6 UNET.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import Foundation
// We provide some json and transform it to Data-type
let json = """
[{
"name": "John",
"startingTime": 581167640.06502903
}, {
"name": "Mark",
"startingTime": 582031640.06502903