Skip to content

Instantly share code, notes, and snippets.

View hvsw's full-sized avatar
🏠
Working from home

Henrique Valcanaia hvsw

🏠
Working from home
View GitHub Profile
let x = try! divide(2, 2)
let photo = try! loadImage("./Resources/John Appleseed.jpg")
@hvsw
hvsw / Data+HexString.swift
Last active August 3, 2017 00:26
Hex string representing Data
import Foundation
extension Data {
var hexString: String {
let hexString = map { String(format: "%02.2hhx", $0) }.joined()
return hexString
}
}
// TO BE CONTINUED...
extension Notification.Name {
func post(to notificationCenter: NotificationCenter = .default, withObject object: Any? = nil) {
notificationCenter.post(name: self, object: object)
}
}
extension Notification {
struct MyApp {
@hvsw
hvsw / DynamicTypeResponsive.swift
Created October 15, 2018 19:09 — forked from stevethomp/DynamicTypeResponsive.swift
Adds a simple way to register a view for automatic dynamic type updating by setting respondsToDynamicTypeChanges = true. Really only useful on iOS < 10
import Foundation
import ObjectiveC
// MARK: - DynamicTypeResponsive
protocol DynamicTypeResponsive {
var respondsToDynamicTypeChanges: Bool { get set }
}
extension UILabel: DynamicTypeResponsive {
var respondsToDynamicTypeChanges: Bool {
@hvsw
hvsw / bash_profile.sh
Created December 15, 2020 14:24
macOS developer free space
function freespace() {
# rm -rf ~/Library/Containers/com.apple.mail/Data/Library/Mail\ Downloads/
# https://stackoverflow.com/a/53199763/3724306
echo "1. Boot all the sims that I want to use"
echo "2. remove all the simulators that I don't have booted"
echo "Run: xcrun simctl list | grep -w \"Shutdown\" | grep -o \"([-A-Z0-9]*)\" | sed \'s/[\(\)]//g\\' | xargs -I uuid xcrun simctl delete uuid"
echo "Cleaning ~/Library/Caches/com.apple.dt.Xcode..."
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*