Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Bunn Bunn

View GitHub Profile
View SwiftPrinter.py
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 Jun 18, 2020 — forked from zntfdr/firebase-iOS-breakdown.swift
Firebase iOS Version breakdown
View firebase-iOS-Device-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
View defer
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
Cleanup space
View cleanup.sh
#!/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
View dev_cleanup.sh
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 Feb 12, 2017
Swift 3.0 HTTP Basic Authentication on Playground
View authenticate.swift
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func authenticate () {
//Credentials
let username = "USERNAME"
let password = "PASSWORD"