Skip to content

Instantly share code, notes, and snippets.

View hectorddmx's full-sized avatar

Hector De Diego hectorddmx

View GitHub Profile
@ryantan
ryantan / resign-ipa.md
Last active August 6, 2025 02:46
How to resign an .ipa

How to Resign an iOS App

Let's say you receive an app (e.g. MyApp.ipa) from another developer, and you want to be able to install and run it on your devices (by using ideviceinstaller, for example).

Or your certificates and provision profiles have expired and you want to provide a new build to your clients without having to make a new build on the latest XCode or iOS SDK.

Prepare New Signing Assets

The first step is to attain a Provisioning Profile which includes all of the devices you wish to install and run on. Ensure that the profile contains a certificate that you have installed in your Keychain Access (e.g. iPhone Developer: Some Body (XXXXXXXXXX) ). Download the profile (MyProfile.mobileprovision) so you can replace the profile embedded in the app.

@cprovatas
cprovatas / Data+PrettyPrint.swift
Created May 23, 2018 15:52
Pretty print JSON string from Data in Swift 4.1 (especially useful printing to Xcode console)
import Foundation
extension Data {
var prettyPrintedJSONString: NSString? { /// NSString gives us a nice sanitized debugDescription
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
}
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active October 31, 2025 02:41
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@TomSoderling
TomSoderling / Disable iOS Simulator Incoming Connections Popup.sh
Last active December 14, 2023 10:26
Bash script for turning off the iOS simulator pop-up message
#!/bin/bash
# Script to disable the iOS Simulator app from showing the "Do you want the application xxxx to accept incoming network connections?" pop-up every time the app is run
echo "> Enter password to temporarily shut firewall off"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "> Add Xcode as a firewall exception"
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode
@d-date
d-date / UIActivityType+PopularServices.swift
Created March 14, 2018 10:08
Share extension for popular apps
private extension UIActivityType {
static let postToLINE = UIActivityType("jp.naver.line.Share")
static let gmail = UIActivityType("com.google.Gmail.ShareExtension")
static let postToSlack = UIActivityType("com.tinyspeck.chatlyio.share")
static let facebookMessanger = UIActivityType("com.facebook.Messenger.ShareExtension")
static let tweetbot4 = UIActivityType("com.tapbots.Tweetbot4.shareextension")
static let evernote = UIActivityType("com.evernote.iPhone.Evernote.EvernoteShare")
static let bear = UIActivityType("net.shinyfrog.bear-iOS.Bear-iPhone-Sharing-Extension")
}
@StanDimitroff
StanDimitroff / UIImage+CIPerspectiveCorrection.swift
Last active December 31, 2024 03:08
Image perspective correction
extension UIImage {
var flattened: UIImage? {
let ciImage = CIImage(image: self)!
guard let openGLContext = EAGLContext(api: .openGLES2) else { return nil }
let ciContext = CIContext(eaglContext: openGLContext)
let detector = CIDetector(ofType: CIDetectorTypeRectangle,
context: ciContext,
options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])!
@typebrook
typebrook / MBTilesServer.kt
Last active March 18, 2025 05:50
How to make MBTiles valid on Mapbox Android SDK #mbtiles #android #mapbox
package com.example.sample.offline
import android.util.Log
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
import java.io.FileNotFoundException
import java.io.PrintStream
import java.net.ServerSocket
import java.net.Socket
import kotlin.math.pow
@grossbart
grossbart / nix.md
Last active February 28, 2025 04:15
Nix on macOS

Nix

Nix is a powerful package manager that makes package management reliable and reproducible. It provides atomic upgrades and rollbacks, side-by-side installation of multiple versions of a package, multi-user package management and easy setup of build environments.

Installation

@jellybeansoup
jellybeansoup / AppDelegate.swift
Created January 23, 2018 05:39
Preloading App Data for Screenshots
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
prepareForTestingUI()
// Handle the actual launch of your application
}
private func prepareForTestingUI() {
guard let contentsURL = Bundle.main.url(forResource: "UITests", withExtension: "xcappdata")?.appendingPathComponent("AppData") else {
return
}
@namannik
namannik / MGLMapView+MBTiles.swift
Last active December 4, 2024 10:27
MGLMapView+MBTiles
import Foundation
import Mapbox
import SQLite
// MARK: MbtilesSource
enum MBTilesSourceError: Error {
case CouldNotReadFileError
case UnknownFormatError
case UnsupportedFormatError