Skip to content

Instantly share code, notes, and snippets.

@insidegui
insidegui / reloadplugins.sh
Created January 29, 2022 23:00
Make your Mac app's extensions immediately available on macOS with a run script build phase
# Add this to a "Run Script" build phase in your app's main target, as the last step.
# It will use the pluginkit command-line tool to force the plugin system on macOS to add your extensions to its database, making them available.
# I made this specifically for widgets, but it should work for pretty much any extension type (appex bundle).
find $CODESIGNING_FOLDER_PATH -name '*.appex' -exec pluginkit -a {} \;
@kenji21
kenji21 / xcode-previous-older-sdks.md
Last active April 21, 2024 13:40
Use previous/older SDKs with Xcode
@opsb
opsb / NonMutatingArray.swift
Last active February 17, 2022 15:34
Swift extension to add non mutating methods to Array
extension Array {
func inserted(_ element: Element, at index: Int) -> Array<Element> {
return updated({$0.insert(element, at: index)})
}
func appended(_ element: Element) -> Array<Element> {
return updated({$0.append(element)})
}
func appended(contentsOf elements: Array<Element>) -> Array<Element> {
@Zhuinden
Zhuinden / FragmentViewBindingDelegate.kt
Last active February 24, 2024 20:13
Fragment view binding delegate
// https://github.com/Zhuinden/fragmentviewbindingdelegate-kt
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import androidx.viewbinding.ViewBinding
import kotlin.properties.ReadOnlyProperty
@nnsnodnb
nnsnodnb / AnyError.swift
Last active February 29, 2024 17:41
How to upload jpeg image using URLSession.
import Foundation
struct AnyError: Error {
let error: Error
init(_ error: Error) {
self.error = error
}
}
@joshbalfour
joshbalfour / extract.js
Created June 23, 2019 15:43
RiKroll - extract assets protected using Kroll's AssetCrypt
const fs = require('fs')
const path = require('path')
const fse = require('fs-extra')
const code = fs.readFileSync('app.code.json', 'utf-8')
const obj = JSON.parse(code)
Object.entries(obj).forEach(([loc, contents]) => {
const absPath = path.resolve('.', 'output', loc)
@natbro
natbro / fixup-old-macos-sdks.sh
Created November 13, 2018 03:10
script to link older macOS SDKs into newer Xcode so you can target older platforms properly
#!/bin/bash
# ---------------------------------------------------------------------------------------------------------
# place as many old macOS SDKs into the directory with this script e.g. if you have
#
# my-macpro:SDKs natb$ ls -ahl
# total 4254792
# drwxr-xr-x 17 natb admin 578B Nov 21 2017 .
# drwxrwxr-x 24 root admin 884B Aug 29 06:46 ..
# drwxr-xr-x 5 natb admin 170B Oct 17 2017 MacOSX10.10.sdk
@yoavst
yoavst / TitaniumResourcesExtractor.kt
Created September 9, 2017 12:21
Titanium app resources extractor
package com.yoavst.psychometric
import org.apache.commons.lang3.StringEscapeUtils
import java.io.File
import java.nio.CharBuffer
import javax.crypto.spec.SecretKeySpec
import javax.crypto.Cipher
/**
* Based on https://www.npmjs.com/package/ti_recover
//: Playground - noun: a place where people can play
import UIKit
//initialization
//value types get defautlt initializers , structs and enums
//1- failable and throwing initializers
//What happens if we can't initialize an object? This is a common occurrence if initialization depends on external data. Swift gives us two ways to deal with this - failable and throwing initializers.
@bodja
bodja / change-sdk.sh
Last active June 22, 2023 03:32
Download MacOSX SDK version and change minimum sdk version in info.plist
SDK_VERSION=$1
SDK_NAME="MacOSX${SDK_VERSION}.sdk"
TAR_FILE_NAME="${SDK_NAME}.tar.xz"
DOWNLOAD_URL="https://github.com/phracker/MacOSX-SDKs/releases/download/MacOSX10.11.sdk/${TAR_FILE_NAME}"
TAR_FILE_DEST="/tmp/${TAR_FILE_NAME}"
SDK_MIN_VERSION_FILE="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist"
SDK_DIR="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/"
echo Downloading $SDK_NAME
curl -L $DOWNLOAD_URL -o $TAR_FILE_DEST --progress-bar