Skip to content

Instantly share code, notes, and snippets.

@camyoh
camyoh / getIP.swift
Last active April 10, 2024 02:28
Get the IP on iphone, swift 5
let ipName = getIpAddress() ?? ""
func getIpAddress() -> String? {
var address : String?
// Get list of all interfaces on the local machine:
var ifaddr : UnsafeMutablePointer<ifaddrs>?
guard getifaddrs(&ifaddr) == 0 else { return nil }
guard let firstAddr = ifaddr else { return nil }
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
/**
Goal: have a properly localized date (month/day in the correct order), yet
have a custom date component separator.
Example as follows:
*/
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
NSLocale *gbLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_GB"];
NSLocale *deLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"];