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
template<auto... Val> | |
struct List; | |
template<> | |
struct List<> { | |
template<auto Elem> | |
using Append = List<Elem>; | |
}; | |
template<auto Head, auto... _Rest> |
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
// | |
// DarkModeMasker.swift | |
// SwiftUI Demos | |
// | |
// Created by Morten Just on 1/22/23. | |
// https://twitter.com/joshguospace/status/1617101052192649216?s=12 | |
import SwiftUI | |
import Charts |
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
// A view that can flip between its "front" and "back" side. | |
// | |
// Animation implementation based on: | |
// Chris Eidhof, Keyframe animations <https://gist.github.com/chriseidhof/ea0e435197f550b195bb749f4777bbf7> | |
import SwiftUI | |
// MARK: - Chris's keyframe animation design | |
struct Keyframe<Data: Animatable> { |
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
cd $path | |
DATE=`date -v-6d +"%Y-%m-%d"` | |
AUTHOR=`git config user.name` | |
LOG=`git log --branches --pretty=format:"\n%ad: %s" --date=short --after=$DATE --author="$AUTHOR"` | |
CHANGES=`git log --branches --date=short --after=$DATE --author="$AUTHOR" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "本周贡献代码: +%s行, -%s行, 总行数: %s\n", add, subs, loc }' -` | |
WEEKSTART=`date -v"monday" +"%-m月%d"` | |
TODAY=`date +"%-m月%d"` | |
REPORT="【周报】$WEEKSTART ~ $TODAY \n\n$CHANGES\n$LOG\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
struct Test1 { | |
var ww: Int | |
var xx: String | |
} | |
struct Partial<T> { | |
internal var values: [PartialKeyPath<T>: Any] = [:] | |
subscript<V>(key: KeyPath<T, V>) -> V? { | |
get { |
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 UIKit | |
struct SetSheetDelegate: UIViewRepresentable { | |
let delegate:SheetDelegate | |
init(isDisable:Bool,attempToDismiss:Binding<UUID>){ | |
self.delegate = SheetDelegate(isDisable, attempToDismiss: attempToDismiss) | |
} |
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 Throttle { | |
private let queue: DispatchQueue | |
private let delay: Double | |
private var delayedBlock: (() -> Void)? | |
private var cancelBlock: (() -> Void)? | |
private var timer: DispatchSourceTimer? | |
private var isReady = true | |
private var hasDelayedBlock: Bool { delayedBlock != nil } |
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
// | |
// VirtualKeyboard.swift | |
// MacBook Air M1 Zhuyin Keyboard | |
// Written with SwiftUI ~=300 LOC, < 4hrs | |
// Created by Ethan Huang on 2021/1/13. | |
// Twitter: @ethanhuang13 | |
import SwiftUI | |
struct VirtualKeyboard: View { |
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 UIKit | |
protocol DefaultValue { | |
associatedtype Value: Decodable | |
static var defaultValue: Value { get } | |
} | |
@propertyWrapper | |
struct Default<T: DefaultValue> { | |
var wrappedValue: T.Value |
NewerOlder