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
@ahmedAlmasri
ahmedAlmasri / ImageCompression.swift
Last active August 30, 2023 10:47
ios swift Image compression
//: Playground - noun: a place where people can play
import UIKit
do{
func compressImage(_ img:UIImage) -> UIImage? {
// Reducing file size to a 10th
var actualHeight: CGFloat = img.size.height
var actualWidth: CGFloat = img.size.width
let maxHeight: CGFloat = 1136.0
@spookyd
spookyd / iOS-Argument_cheatsheet.md
Last active May 8, 2021 11:30
Cheat sheet for iOS Project arguments

Application Argument Debug Cheat Sheet


A curated list of arguments that can be used for enabling tools on iOS development.

Launch Arguments

Core Data

@jerrymarino
jerrymarino / SwiftBinaryDemangler.sh
Created January 30, 2019 19:49
Demangle the entire symbol table of a swift binary
nm __BINARY__ | awk '{ print $3 }' | xargs xcrun swift-demangle {} \; | less
@hishma
hishma / updateBuildNumber.sh
Last active April 13, 2023 15:12
Shell script to update the build number (CFBundleVersion) of the info.plist in the build folder.
# Shamelessly ripped of from https://blog.curtisherbert.com/automated-xcode-build-numbers-early-2019-edition/
#
git=`sh /etc/profile; which git`
bundleVersion=`"$git" rev-list --all | wc -l | tr -d '[:space:]'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "☛ BUILD NUMBER: ${bundleVersion}"
@mvnrc
mvnrc / CArray.swift
Last active February 18, 2020 03:40
An extension of UnsafeMutablePointer for converting C array to Swift array
extension UnsafeMutablePointer {
/// Converts `C` decayed array to `Swift` array
///
/// - Parameter count: Number of elements in the `C` array
/// - Returns: Converted `Swift` array
public func toArray(count: Int) -> [Pointee] {
defer { self.deallocate() }
return Array(UnsafeBufferPointer(start: self, count: count))
}
@codediodeio
codediodeio / config.js
Last active April 7, 2025 00:44
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
@neilpoulin
neilpoulin / Book.swift
Last active November 30, 2023 17:41
Encoding/Decoding Firestore Timestamps with Swift
//
// Example Model class that can be used for deocding/encoding for persisting in Firestore
// Book.swift
// Created by Neil Poulin on 4/7/19.
//
import Foundation
import FirebaseFirestore
struct Book: FirestoreIdentifiable, Hashable {
static let collectionName = FirestoreCollectionName.books
@stinger
stinger / CombineFetcher.swift
Last active January 28, 2023 18:07
Combine - fetching data using URLSession publishers
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
// 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)
}