Skip to content

Instantly share code, notes, and snippets.

@monmonja
monmonja / generate-ios.sh
Created July 16, 2019 13:16
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload
@pteasima
pteasima / OnScroll.swift
Last active December 16, 2020 17:35
SwiftUI onScroll
import SwiftUI
import Combine
struct OnScroll: ViewModifier {
@Binding var offset: CGFloat
//we can have a version with a closure instead of the binding, but that triggers an infinite loop if content depends on the same Store
// var onOffset: (CGFloat) -> ()
func body(content: Content) -> some View {
return VStack {
@ksmandersen
ksmandersen / PaddedTextField.swift
Last active July 18, 2024 09:44
Best way to inset text inside a UITextField
import UIKit
open class PaddedTextField: UITextField {
public var textInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) {
didSet { setNeedsDisplay() }
}
public override init(frame: CGRect) {
super.init(frame: frame)
}
@alexathylane
alexathylane / iOS Universal Links Support Checklist.md
Last active August 8, 2024 09:35
iOS Universal Links Support Checklist
@aanari
aanari / pod_force_reinstall.sh
Created May 4, 2017 20:37
Reinstall Cocoa Pods and Clear Cache
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.1.1
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf Pods
pod update

Set up git editor

The main command is:

git config --global core.editor "path to your editor with params"

Set up an editor and check it by making a commit:

@jonathan-beebe
jonathan-beebe / clean_old_code_simulators.sh
Last active February 12, 2019 19:40
Clean out unused Xcode Simulators
# Close Xcode & the iOS Simulator
# http://stackoverflow.com/a/30940055
# Remove any old runtimes from this directory.
cd /Library/Developer/CoreSimulator/Profiles/Runtimes
# e.g.
sudo rm -rf iOS\ 8.1.simruntime
# http://stackoverflow.com/a/11790983
# Remove the download receipts for simulators you don't need anymore.
@MoathOthman
MoathOthman / gist:b3cef77057028e4c2e70
Created March 3, 2015 07:18
Convert from p12 to PEM Terminal
openssl pkcs12 -in Certificatesdev.p12 -out Certificatesdev.pem -nodes -clcerts
@lippling
lippling / simulators.sh
Created September 23, 2014 13:17
Show installed iOS Simulators (Xcode 6+)
find ~/Library/Developer/CoreSimulator/Devices/ -name device.plist -exec sh -c "/usr/libexec/PlistBuddy -c \"print UDID\" '{}' | tr '\n' ' '" \; -exec sh -c "/usr/libexec/PlistBuddy -c \"print name\" '{}' | tr '\n' ' '" \; -exec sh -c "/usr/libexec/PlistBuddy -c \"print runtime\" '{}' | sed -n 's/com\.apple\.CoreSimulator.SimRuntime\.\(.*\)/\1/p'" \;
@romaonthego
romaonthego / NSDateFormatter cheat sheet
Last active April 7, 2025 11:05
Date Formats for NSDateFormatter
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)