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
| """ | |
| The most atomic way to train and inference a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
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
| // | |
| // ContentView.swift | |
| // Airdrop Demo | |
| // | |
| // Created by Daniel Kuntz on 7/30/23. | |
| // | |
| import SwiftUI | |
| 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
| extension Color { | |
| /// Return a random color | |
| static var random: Color { | |
| return Color( | |
| red: .random(in: 0...1), | |
| green: .random(in: 0...1), | |
| blue: .random(in: 0...1) | |
| ) | |
| } | |
| } |
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
| /** | |
| * This Gist is part of a medium article - read here: | |
| * https://jamiecurnow.medium.com/using-firestore-with-typescript-65bd2a602945 | |
| */ | |
| // import firstore (obviously) | |
| import { firestore } from "firebase-admin" | |
| // Import or define your types | |
| // import { YourType } from '~/@types' |
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 PlaygroundSupport | |
| struct Desktop: View { | |
| var body: some View { | |
| ZStack { | |
| // Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG")) | |
| Color(UIColor.systemBlue) | |
| macOS() | |
| } |
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
| // | |
| // SnapCarousel.swift | |
| // prototype5 | |
| // | |
| // Created by xtabbas on 5/7/20. | |
| // Copyright © 2020 xtadevs. All rights reserved. | |
| // | |
| import SwiftUI |
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
| // Created by Marcin Krzyzanowski | |
| import Foundation | |
| public protocol JSONEncodable: Encodable { } | |
| public extension JSONEncodable { | |
| func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
| try String(decoding: encoder().encode(self), as: UTF8.self) | |
| } |
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
| public extension UIImage { | |
| /// Creates a dynamic image that supports displaying a different image asset when dark mode is active. | |
| static func dynamic( | |
| light makeLight: @autoclosure () -> UIImage, | |
| dark makeDark: @autoclosure () -> UIImage | |
| ) -> UIImage { | |
| if #available(iOS 13, *) { | |
| return UIDynamicProviderImage(light: makeLight(), dark: makeDark()) | |
| } else { |
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 | |
| struct AdaptsToSoftwareKeyboard: ViewModifier { | |
| @State var currentHeight: CGFloat = 0 | |
| func body(content: Content) -> some View { | |
| content | |
| .padding(.bottom, currentHeight) | |
| .edgesIgnoringSafeArea(.bottom) |
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
| // | |
| // PagingList.swift | |
| // | |
| // Created by Sriram Manian on 6/17/19. | |
| // Copyright © 2019 Sriram Manian. All rights reserved. | |
| // | |
| import SwiftUI | |
| import Combine |
NewerOlder