Skip to content

Instantly share code, notes, and snippets.

View eivindml's full-sized avatar
🌱
Developing a new macOS app.

Eivind Lindbråten eivindml

🌱
Developing a new macOS app.
View GitHub Profile
@eivindml
eivindml / FetchedResultsPublisher.swift
Last active January 30, 2022 13:42 — forked from darrarski/FetchedResultsPublisher.swift
Swift-Combine-CoreData-Fetched-Results-Publisher
import Combine
import CoreData
public final class FetchedResultsPublisher<ResultType>: Publisher where ResultType: NSFetchRequestResult {
public init(request: NSFetchRequest<ResultType>, context: NSManagedObjectContext) {
self.request = request
self.context = context
}

Keybase proof

I hereby claim:

  • I am eivindml on github.
  • I am eivindml (https://keybase.io/eivindml) on keybase.
  • I have a public key ASATuy7kGECPbRBUdF1UOy6nCe4mmVqVovReT6olRRAfQAo

To claim this, I am signing this object:

import BlockContent from "@sanity/block-content-to-react";
interface ArticleProps {
content: Array<any>;
}
export default function Article(props: ArticleProps) {
return (
<>
<BlockContent
@eivindml
eivindml / favicon.html
Last active August 26, 2020 11:01
Minimal default list of favicon formats to support.
<!-- Touch Icons - iOS and Android 2.1+ 180x180 pixels in size. -->
<link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png">
<!-- Firefox, Chrome, Safari, IE 11+ and Opera. 192x192 pixels in size. -->
<link rel="icon" href="/path/to/favicon.png">
<!-- Vector image for Safari pinned tab. Single layer svg with viewBox 0 0 16 16. -->
<link rel="mask-icon" href="website_icon.svg" color="#151714">
let ui = {
setDisplayName: (name) => {
document.getElementById('displayName').innerHTML = name
},
setProfilePicture: (imgBlob) => {
document
.getElementById('profileImg')
.setAttribute('src', URL.createObjectURL(imgBlob))
},
import SwiftUI
struct WheelData {
let strokeWidth: CGFloat
let knobWidth: CGFloat
}
struct WheelView: View {
@State var position: CGSize?
@State var angle: CGFloat = 0
CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](35): Validating options: <NSCloudKitMirroringDelegateOptions: 0x2803fb400> containerIdentifier:iCloud.Minutes ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<PFCloudKitContainerProvider: 0x282fe90a0> storeMonitorProvider:<PFCloudKitStoreMonitorProvider: 0x282fe9090> metricsClient:<PFCloudKitMetricsClient: 0x282fe9060> metadataPurger:<PFCloudKitMetadataPurger: 0x282fe90b0> scheduler:<null> notificationListener:<null> containerOptions:<null>
storeOptions: {
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x282dc
@eivindml
eivindml / GameDetail.swift
Created September 3, 2019 18:31
SwiftUI ImageLoader with caching
let url = URL(string: "https://mist.eivindml.now.sh/static/Artboard.png")!
struct GameDetail: View {
@State var nowDate = Date()
private var refDate: Date {
let formatter = DateFormatter()
formatter.dateFormat = "YYYY-MM-dd HH:mm:ss"
let rDate = formatter.date(from: "20019-10-11 12:12:12")
return rDate!
import SwiftUI
struct GameDetail: View {
@State var nowDate = Date()
private var refDate: Date {
let formatter = DateFormatter()
formatter.dateFormat = "YYYY-MM-dd HH:mm:ss"
let rDate = formatter.date(from: "20019-10-11 12:12:12")
return rDate!
import SwiftUI
struct Model {
var title: String
var body: String
}
struct ContentView : View {
@State var models : [Model] = [
Model(title: "First Entry", body: "first body"),