This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'date' | |
| require 'optparse' | |
| require 'pathname' | |
| require 'json' | |
| require 'fileutils' | |
| # --- | |
| # 1. Option Parsing and Help |
This file contains hidden or 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 | |
| // MARK: - Basic | |
| public struct CellLayout<Icon: View, Content: View, Accessory: View>: View { | |
| @State var cellHeight: CGFloat = 0 | |
| var horizontalGap: CGFloat | |
| var verticalGap: CGFloat |
This file contains hidden or 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
| #if canImport(SwiftUI) && DEBUG | |
| import SwiftUI | |
| struct DebugJsonView: View { | |
| let json: JsonElement | |
| init(_ json: String) { | |
| self.json = JsonElement.parse(json) |
This file contains hidden or 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 | |
| struct ContentView: View { | |
| var body: some View { | |
| ScrollView { | |
| LazyVStack { | |
| ForEach(0..<10000, id: \.self) { i in | |
| Text("No.\(i)") | |
| .padding() |
This file contains hidden or 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 | |
| struct OffsetKey: PreferenceKey { | |
| static var defaultValue: CGFloat = .zero | |
| static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | |
| value = nextValue() | |
| } | |
| } | |
| struct ContentView: View { |
This file contains hidden or 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 Combine | |
| protocol InfinityScrollDataSource: AnyObject { | |
| associatedtype Element: Identifiable | |
| typealias Index = Int | |
| associatedtype ObjectWillChangePublisher : Publisher = ObservableObjectPublisher where ObjectWillChangePublisher.Failure == Never | |
| var count: Int { get } | |
| var objectWillChange: ObjectWillChangePublisher { get } |
This file contains hidden or 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
| // | |
| // Camera.swift | |
| // CameraTest | |
| // | |
| import UIKit | |
| import CoreImage | |
| import VideoToolbox | |
| import AVFoundation |
This file contains hidden or 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
| const validate = require('json-schema').validate; | |
| const YAML = require('yaml'); | |
| const fs = require('fs').promises; | |
| const main = async () => { | |
| const doc = YAML.parse(await fs.readFile('./doc.yml', { encoding: 'utf-8' })); | |
| const schema = YAML.parse(await fs.readFile('./schema.yml', { encoding: 'utf-8' })); | |
| console.log({ doc, schema }); | |
| console.log(validate(doc, schema)); | |
| } |
This file contains hidden or 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
| const rollSingle = (face: number, rolled: number[]): number => { | |
| const r = Math.ceil(Math.random() * face) | |
| rolled.push(r) | |
| return r | |
| } | |
| const roll = (count: number, face: number, rolled: number[]): number => [...Array(count)].reduce(r => r + rollSingle(face, rolled), 0) | |
| globalThis.roll = roll |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder