Skip to content

Instantly share code, notes, and snippets.

View byaruhaf's full-sized avatar
🏄
Surfing Xcode

Franklin Byaruhanga byaruhaf

🏄
Surfing Xcode
View GitHub Profile
@byaruhaf
byaruhaf / py_syslog_dict_config.py
Created April 27, 2025 04:53 — forked from biggers/py_syslog_dict_config.py
Python dictConfig logging example using SyslogHandler - modified from Stackoverflow answer
import logging
import sys
from logging import config
# REF, modified from:
# https://stackoverflow.com/a/19367225
if sys.platform == "darwin":
address = '/var/run/syslog'
facility = 'local1'

Docker Swarm Cheat Sheet

Initialize the local Docker service as a swarm manager. As a guideline, in production you should have 3 to 5 managers. Swarm is managed through port 2377, which should be blocked from external access.

$ docker swarm init

Join an existing swarm as a worker node. Replace $SWARM_MANAGER with the IP address or domain name of a swarm manager node.

@byaruhaf
byaruhaf / PurchaseManager.swift
Created October 30, 2024 11:15 — forked from lienmt/PurchaseManager.swift
PurchaseManager with SwiftUI & StoreKit
import Foundation
import StoreKit
enum ProductsId: String {
case subsWeekly24 = "WeeklyId"
case subsAnnual24 = "AnnualId"
}
@MainActor
class PurchaseManager: NSObject, ObservableObject {
@byaruhaf
byaruhaf / Extension+Logger.swift
Created October 4, 2024 21:07 — forked from bobdel/Extension+Logger.swift
General purpose global logging and signpost configuration file
//
// Extension+Logger.swift
//
// Created by Robert DeLaurentis on 3/13/24.
// Last Modified on 10/4/24.
///**
/// General purpose global logging and signpost configuration
/// file tested on Xcode 16 and iOS 18 with
/// Swift 6 toolchain and strict concurrency
@byaruhaf
byaruhaf / RequestState.kt
Created March 17, 2024 05:32 — forked from stevdza-san/RequestState.kt
Useful wrapper class for handling the data in Jetpack Compose
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.runtime.Composable
sealed class RequestState<out T> {
data object Idle : RequestState<Nothing>()
data object Loading : RequestState<Nothing>()
@byaruhaf
byaruhaf / libs.versions.toml
Created September 16, 2023 16:16 — forked from BobbyESP/libs.versions.toml
A very complete TOML file for Android Development mainly thought for the new Jetpack Compose framework
[versions]
accompanist = "0.29.2-rc"
androidGradlePlugin = "7.4.2"
androidxComposeBom = "2023.01.00"
androidxComposeCompiler = "1.4.6"
androidxCore = "1.10.0-rc01"
androidMaterial = "1.9.0-alpha02"
androidxAppCompat = "1.7.0-alpha02"
androidxActivity = "1.7.1"
markdownDependency = "0.3.2"
Company:
Role:
Full-time:
Remote OK:
Sponsorship:
Salary Range: [Actual range, not "Based on experience or skillset, location" or so forth]
Contact:
Location:
Relocation Assistance:
Brief Description:
@byaruhaf
byaruhaf / Searchable_iOS16.swift
Created July 18, 2023 00:31 — forked from marcoarment/Searchable_iOS16.swift
Backporting iOS 17's SwiftUI .searchable($isPresented) binding for iOS 16
import SwiftUI
extension View {
public func searchable_iOS16(text: Binding<String>, isPresented: Binding<Bool>, placement: SearchFieldPlacement) -> some View {
modifier(Searchable_iOS16(text: text, isPresented: isPresented, placement: placement))
}
}
public struct Searchable_iOS16: ViewModifier {
@Binding var text: String
//
// WheelView.swift
// ShowcaseShareCard
//
// Created by Ryan Gittings on 10/07/2023.
//
import SwiftUI
struct ContentView: View {
@byaruhaf
byaruhaf / LocalNotifications.swift
Created June 30, 2023 23:08 — forked from SwiftfulThinking/LocalNotifications.swift
Local Push Notifications for iOS (incl. convenience methods and async support)
import Foundation
import UIKit
import UserNotifications
import CoreLocation
enum NotificationTriggerOption {
case date(date: Date, repeats: Bool)
case time(timeInterval: TimeInterval, repeats: Bool)
case location(coordinates: CLLocationCoordinate2D, radius: CLLocationDistance, notifyOnEntry: Bool, notifyOnExit: Bool, repeats: Bool)