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 | |
# Ensure we are in a git repository | |
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then | |
echo "Not inside a git repository. Exiting." | |
exit 1 | |
fi | |
# Get tags and sort them using version sort | |
TAGS=$(git tag | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -V) |
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
// Generic function to fetch and decode JSON into a Codable object | |
func fetchDecodedObject<T: Codable>(from urlString: String, completion: @escaping (Result<T, NetworkError>) -> Void) { | |
// Step 1: Create a URL instance | |
guard let url = URL(string: urlString) else { | |
completion(.failure(.badURL)) | |
return | |
} | |
// Step 2: Create a URLSession | |
let session = URLSession.shared |
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 RouletteWheel: View { | |
let segments: [String] | |
var onResultSelected: (String) -> Void | |
@State private var rotationAngle: Double = 0 | |
@State private var isSpinning: Bool = false | |
var body: some View { | |
ZStack { |
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 csv | |
import sys | |
import os | |
import re | |
def remove_urls(text): | |
url_pattern = re.compile(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') | |
return url_pattern.sub(r'', text) | |
def read_csv(filename, output_filename): |
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 AVFoundation | |
struct QRCodeScannerView: UIViewControllerRepresentable { | |
var handleQRCode: (String) -> Void | |
func makeUIViewController(context: Context) -> QRCodeScannerViewController { | |
let viewController = QRCodeScannerViewController() | |
viewController.handleQRCode = handleQRCode |
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
// | |
// QuizzView.swift | |
// TwinChatAI | |
// | |
// Created by Eon Fluxor on 2/18/23. | |
// | |
import Foundation | |
import SwiftUI |
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 | |
find "." -name '*.framework' -type d | while read -r FRAMEWORK | |
do | |
echo "-----------------------" | |
FRAMEWORK_NAME=$(echo "$FRAMEWORK" | sed 's/\.\/\(.*\)\.framework/\1/') | |
FRAMEWORK_BUNDLE_NAME=$(/usr/libexec/PlistBuddy -c "Print CFBundleName" "$FRAMEWORK/Resources/Info.plist") || exit | |
XCFRAMEWORK_ROOT="./_$FRAMEWORK_NAME.xcframework" | |
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 AVFoundation | |
struct CameraView: View { | |
// Set up the AVCaptureSession and AVCaptureVideoPreviewLayer | |
let captureSession = AVCaptureSession() | |
let previewLayer = AVCaptureVideoPreviewLayer() | |
let cameraDelegate = CameraDelegate() |
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 | |
public class FactoryCache { | |
public typealias MakerClosure<Item> = ()->Item | |
typealias CacheType = NSCache<NSString, InstanceWrapper> | |
struct CacheWrapper{ | |
var storage: CacheType = NSCache() | |
} | |
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
var largeTitleView:UIView{ | |
if let navBarSubviews = navigationController?.navigationBar.subviews { | |
for subView in navBarSubviews where NSStringFromClass(type(of: subView)).contains("LargeTitle"){ | |
return subView | |
} | |
} | |
assert(false, "A large title view is expected on viewDidAppear") | |
return UIView() | |
} |
NewerOlder