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
//: [Previous](@previous) | |
import Foundation | |
import SwiftUI | |
import Combine | |
//: Current Value Subject is a value, a publisher and a subscriber all in one | |
let currentValueSubject = CurrentValueSubject<Bool, Never>(true) | |
print(currentValueSubject.value) |
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
#!/bin/bash | |
# <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" /> | |
# root ssh keys | |
mkdir /root/.ssh | |
echo $SSH_KEY >> /root/.ssh/authorized_keys | |
chmod 0700 /root/.ssh | |
# update to latest |
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
//: [Previous](@previous) | |
import SwiftUI | |
import Combine | |
import PlaygroundSupport | |
class Context: ObservableObject { | |
@Published var selectedItems: Set<String> | |
@Published var items: Array<String> | |
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
// | |
// UIView+VisualRecursiveDescription.h | |
// | |
// Created by Paul Wood on 8/28/19. | |
// Copyright © 2019 Paul Wood. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> |
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 SwiftUI | |
import CoreData | |
import Combine | |
struct NamesByYearView: View { | |
@EnvironmentObject var coreDataStack: CoreDataStack | |
@Environment(\.managedObjectContext) var managedObjectContext | |
@EnvironmentObject var importer: NameDatabaseImporter | |
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
// | |
// ImageDownloaderCommonBlocks.h | |
// AsyncImageDownloader | |
// | |
// Created by Paul Wood on 9/23/19. | |
// Copyright © 2019 Paul Wood. All rights reserved. | |
// | |
#ifndef ImageDownloaderCommonBlocks_h | |
#define ImageDownloaderCommonBlocks_h |
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
// | |
// main.swift | |
// LRUCache | |
// | |
// Created by Paul Wood on 9/19/19. | |
// Copyright © 2019 Paul Wood. All rights reserved. | |
// | |
import Foundation |
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 | |
class Box<T> { | |
typealias Observer = (T) -> Void | |
var observer: Observer? | |
func bind(observer: Observer?) { | |
self.observer = observer | |
} | |
var value: T { | |
didSet { |
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
func gcd_recursive(_ a: Int, _ b : Int) -> Int { | |
let higher = max(a, b) | |
let lower = min(a, b) | |
let r = higher % lower | |
if r == 0 { | |
return lower | |
} | |
return gcd_recursive(lower, r) | |
} |
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 | |
/* | |
Given an array of integers, return indices of the two numbers such that they add up to a specific target. | |
You may assume that each input would have exactly one solution, and you may not use the same element twice. | |
Example: | |
Given nums = [2, 7, 11, 15], target = 9, |
NewerOlder