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 | |
struct ContentView: View { | |
let startDate = Date() | |
var body: some View { | |
GeometryReader { gp in | |
TimelineView(.animation) { ctx in | |
Rectangle() | |
.ignoresSafeArea() |
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 SwiftMath | |
enum ContentItem: Identifiable { | |
case text(_ text: String, id: Int) | |
case equation(_ equation: String, id: Int) | |
// this is obviously very simplistic/needs improvement if to be used for reals | |
static func parse(input: String) -> [ContentItem] { | |
let items = input.split(separator: "$$\n") |
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
// 1. Set up adapative items (repeat, with min/max width), then add spacing as second argument to GridItem: | |
var columns = [GridItem(.adaptive(minimum: 240, maximum: 420), spacing: spacing)] | |
var body: some View { | |
VStack { | |
ScrollView { | |
LazyVGrid(columns: columns, spacing: spacing) { // 4. also add spacing here (between rows) | |
ForEach(document.state.cards) { card in | |
// 2. Item, then with heights that take full width + some fixed height: |
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 | |
extension String { | |
var asAttributedMarkdown: AttributedString { | |
do { | |
return try AttributedString(markdown: self, options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace)) | |
} catch { | |
return AttributedString(stringLiteral: self) | |
} | |
} |
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 Lexical | |
struct ContentView: View { | |
@StateObject var store = LexicalStore() | |
var body: some View { | |
VStack { |
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 | |
extension View { | |
func unfuckText() -> some View { | |
fixedSize(horizontal: false, vertical: true) | |
} | |
} |
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
const fs = require("fs"); | |
const path = require("path"); | |
const mds = fs.readdirSync("./").filter((f) => f.includes(".md")); | |
let contents = ` | |
--- | |
title: Sonic Pi Tutorial | |
author: Sam Aaron | |
... |
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 | |
enum CustomFont { | |
static let notoEmoji = "NotoEmoji-SemiBold" | |
} | |
struct Emoji: View { | |
var text: String | |
var size: CGFloat | |
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 | |
let rawKeys = [ | |
["q","w","e","r","t","y","u","i","o","p"], | |
["a","s","d","f","g","h","j","k","l"], | |
["z","x","c","v","b","n","m"] | |
] | |
enum InputKey: Hashable, Equatable, Codable { | |
case letter(key: String) |
NewerOlder