Skip to content

Instantly share code, notes, and snippets.

@ast3150
ast3150 / Podfile.example
Created March 13, 2023 10:14
Ruby script to download Firebase executables when using PodBuilder
post_install do |pi|
download_executable_script_path = "./download_firebase_executables.rb"
system("ruby #{download_executable_script_path}")
end
@ast3150
ast3150 / .env.prod
Last active October 10, 2022 15:23
Example Fastlane Setup
# General Constants
APP_NAME = "myProject – PROD" # So you can identify your app in Slack, logs, etc.
# Team
USERNAME = "appstore@yourcompany.com" # The Username that you use to log in to AppStore Connect, or developer.apple.com
TEAM_ID = "ABCDEFGH"
# Code Signing
BUNDLE_ID = "com.yourproject.ent.prod" # Your App Bundle Identifier
@ast3150
ast3150 / DisableMacFan.sh
Last active October 2, 2019 14:33
Disabling a broken MacBook fan temporarily to avoid excessive noise
# To disable the fan:
# Read the current minimum speed of fan 0, write this down so you can reset it later if you wish to
sudo /Applications/smcFanControl.app/Contents/Resources/smc -r -k F0Mn
# Set the minimum speed of fan 0. To set the min speed for fan 1, replace F0Mn with F1Mn.
sudo /Applications/smcFanControl.app/Contents/Resources/smc -k F0Mn -w 0000
# Set the fan to forced speed mode. The parameter 0001 forces the speed of fan 0. To force fan 1, use 0002. To force both fans use 0003.
sudo /Applications/smcFanControl.app/Contents/Resources/smc -k "FS! " -w 0001
@ast3150
ast3150 / get-launch-image.mm
Created November 6, 2018 15:57 — forked from luoph/get-launch-image.mm
iOS get App Launch Image
+ (UIImage*)getLaunchImage
{
UIImage* launchImage = nil;
NSArray* imagesDict = [[MainBundle infoDictionary] valueForKey:@"UILaunchImages"];
for (NSDictionary* dict in imagesDict) {
CGSize launchImageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);
if (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, launchImageSize)) {
launchImage = [UIImage imageNamed:dict[@"UILaunchImageName"]];
break;
}
@ast3150
ast3150 / Int+CantorPairing.swift
Created October 15, 2016 16:20
Cantor Pairing in Swift 3
/// Generates a unique integer from the combination of two integers
/// using the Cantor Pairing function.
///
/// # Examples
///
/// f(47, 32) = 3192
///
/// f(32, 47) = 3207
///
/// - seealso: https://en.wikipedia.org/wiki/Pairing_function#Cantor_pairing_function
@ast3150
ast3150 / AssignOptional.swift
Created October 7, 2016 12:29
Swift: Assign Optional Operator
precedencegroup optionalAssignPrecedence {
associativity: left
higherThan: AssignmentPrecedence
}
/// If rhs has a value, assigns rhs to lhs
/// If rhs is an empty optional, does nothing
infix operator ?= : optionalAssignPrecedence
func ?=<T: Any>(lhs: inout T, rhs: T?) {
if let rhs = rhs {