Skip to content

Instantly share code, notes, and snippets.

import lldb
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f SwiftPrinter.printer pjson')
def printer(debugger, command, result, internal_dict):
debugger.HandleCommand('p print(String(data: try! JSONSerialization.data(withJSONObject:' + command + ', options: .prettyPrinted), encoding: .utf8 )!)')
@Bunn
Bunn / firebase-iOS-Device-breakdown
Last active June 18, 2020 11:31 — forked from zntfdr/firebase-iOS-breakdown.swift
Firebase iOS Version breakdown
// How to:
// 1. Go in the Firebase Analytics Dashboard
// 2. Filter iOS Platform only
// 3. Scroll down, select `Device` under the "What is your audience like?" widget
// 4. Export the CSV data (top right of the corner, there's a `...` menu with Download CSV option)
// 5. Open the file and select the Device model breakdown raw data
// 6. Replace your data with the sample data in this script
// 7. Run the script in a Xcode Playground
// 8. See the terminal output
static inline void func_to_cleanup(void (^*block)(void)) {
(*block)();
}
#define concat(a,b) a##b
#define defer(deferBlock) __attribute__((cleanup(func_to_cleanup))) void (^__unused concat(defer_tmp_var, __COUNTER__))(void) = deferBlock
@Bunn
Bunn / cleanup.sh
Created May 19, 2019 15:21
Cleanup space
#!/bin/bash
echo "Removing unavailable simulators..."
xcrun simctl delete unavailable
echo "Brew cleanup..."
brew cleanup
echo "Removing Xcode Caches..."
rm -rf ~/Library/Caches/com.apple.dt.Xcode
@Bunn
Bunn / dev_cleanup.sh
Created February 2, 2019 20:00
Dev Cleanup
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Developer/Xcode/Archives
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport
rm -rf ~/Library/Caches/com.apple.dt.Xcode
xcrun simctl delete unavailable
brew cleanup
@Bunn
Bunn / authenticate.swift
Created February 12, 2017 22:06
Swift 3.0 HTTP Basic Authentication on Playground
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func authenticate () {
//Credentials
let username = "USERNAME"
let password = "PASSWORD"