Skip to content

Instantly share code, notes, and snippets.

@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active November 14, 2024 18:34
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@steve-jansen
steve-jansen / README.md
Last active October 28, 2024 16:59
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@calt
calt / Tabbar.Swift
Last active October 10, 2024 07:06
UITabBar with custom height in Swift, does not work for iOS 14 or later.
// Does not work on iOS 14.0 or later, keeping the gist just for reference.
extension UITabBar {
override open func sizeThatFits(size: CGSize) -> CGSize {
super.sizeThatFits(size)
var sizeThatFits = super.sizeThatFits(size)
sizeThatFits.height = 71
return sizeThatFits
}
}
//
// CameraViewController.swift
// Camera
//
// Created by Stephen Gurnett on 03/01/2016.
// Copyright © 2016 Stephen Gurnett. All rights reserved.
//
import UIKit
import MobileCoreServices
@roymckenzie
roymckenzie / KeyboardAvoidable.swift
Last active September 6, 2022 19:42
Easy way to get your view controllers to respect appearance of the keyboard.
// KeyboardAvoidable
// Roy McKenzie
protocol KeyboardAvoidable: class {
func addKeyboardObservers(customBlock: ((CGFloat) -> Void)?)
func removeKeyboardObservers()
var layoutConstraintsToAdjust: [NSLayoutConstraint] { get }
}
var KeyboardShowObserverObjectKey: UInt8 = 1
@sgr-ksmt
sgr-ksmt / StoryboardInstantiatable.swift
Last active October 12, 2023 09:11
Create UIViewController from storyboard and pass parameter safely.
public protocol StoryboardInstantiatable {
static var storyboardName: String { get }
static var viewControllerIdentifier: String? { get }
static var bundle: Bundle? { get }
}
public extension StoryboardInstantiatable where Self: UIViewController {
public static var storyboardName: String {
return String(describing: self)
}
@vinhnx
vinhnx / uicollectionview+fade.md
Last active February 24, 2022 18:58
Collection view cell fade as scrolling effect

// reference: https://stackoverflow.com/a/42705208/1477298

You can do a lot of fun stuff to collection views. I like to subclass UICollectionViewFlowLayout. Here is an example that fades the top and the bottom of the collection view based on distance from center. I could modify it to fade only the very edges but you should figure it after you look through the code.

import UIKit

class FadingLayout: UICollectionViewFlowLayout,UICollectionViewDelegateFlowLayout {

    //should be 0<fade<1
@lyamamot
lyamamot / generate_app_icons.sh
Created August 9, 2017 16:29
Generate placeholder icons for iOS apps that indicate their own size (in pixels).
#!/bin/bash
# https://developer.apple.com/library/content/qa/qa1686/_index.html
function create_image() {
COLOR=$1
TEXT_COLOR=$2
SIZE=$3
NAME=$4
convert -background "$COLOR" -fill white -font "Tahoma" -size $SIZEx$SIZE label:$SIZE "$NAME"
@krodak
krodak / Realm+CascadeDeleting.swift
Last active April 27, 2023 19:16
Cascade deletion for RealmSwift
import RealmSwift
import Realm
protocol CascadeDeleting: class {
func delete<Entity>(_ list: List<Entity>, cascading: Bool)
func delete<Entity>(_ results: Results<Entity>, cascading: Bool)
func delete<Entity: Object>(_ entity: Entity, cascading: Bool)
}
@siemensikkema
siemensikkema / fixcodeproj.rb
Last active April 15, 2021 14:06
Post processing script for generated vapor Xcode project
#!/usr/bin/env ruby
require 'xcodeproj'
project_path = ARGV[0]
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
# suppress warnings
if [
"Configs",