Skip to content

Instantly share code, notes, and snippets.

:octocat:
Learning

Michael Nisi michaelnisi

View GitHub Profile
@michaelnisi
michaelnisi / tokens.swift
Created Sep 9, 2018
Persisting Change Tokens for CloudKit Sync
View tokens.swift
// MARK: - Storing and Accessing Change Tokens
fileprivate extension UserDefaults {
fileprivate func setUUID(_ uuid: UUID, using key: String) {
self.set(uuid.uuidString, forKey: key)
}
fileprivate func uuid(matching key: String) -> UUID? {
guard let str = UserDefaults.standard.string(forKey: key) else {
@michaelnisi
michaelnisi / update_settings
Last active Jun 18, 2018
Updating the version number in a iOS settings bundle
View update_settings
#!/usr/bin/env bash
set -o xtrace
SOURCE="${BASH_SOURCE[0]}"
if [[ -h $SOURCE ]]; then
SOURCE="$( readlink "$SOURCE" )"
fi
SOURCE_ROOT="${SOURCE_ROOT:-$( cd -P "$( dirname "$SOURCE" )/.." && pwd )}"
@michaelnisi
michaelnisi / configure_otp.sh
Last active Feb 10, 2019
Configure Erlang/OTP build on macOS with pkgin
View configure_otp.sh
./configure --without-javac --without-odbc --with-ssl=/opt/pkg
View gist:63d973f3bf5853e33e9a
Michael,
Hope you're well. I know i've been in touch in the past.
I appreciate that you are busy. The reason i'm reaching out is because i'm sure that you've heard the term NoSQL?
I want to help you understand how Riak fits in this space, and how as a NoSQL Key Value store we are powering online applications for some of the biggest companies worldwide, in a whole host of industries.
E.g -
William Hill
@michaelnisi
michaelnisi / unpack.swift
Last active Aug 29, 2015
Unpack array of any optionals
View unpack.swift
import Foundation
let items: [Any?] = [0, [], "a", nil, "b", nil, "c"]
let strings = reduce(items, [String]()) {
if let string = $1 as? String {
return $0 + [string]
} else {
return $0
}
}
View gist:b00e5ad25d39f08d2888
[auto_vacuum: 0]
[automatic_index: 1]
[cache_size: 250]
[checkpoint_fullfsync: 1]
[name: NOCASE, seq: 0]
[name: RTRIM, seq: 1]
[name: BINARY, seq: 2]
[compile_option: CURDIR]
[compile_option: ENABLE_FTS3]
[compile_option: ENABLE_FTS3_PARENTHESIS]
View keybase.md

Keybase proof

I hereby claim:

  • I am michaelnisi on github.
  • I am nisi (https://keybase.io/nisi) on keybase.
  • I have a public key whose fingerprint is A7B6 30CD 455E CB26 FA54 59D8 7D86 8537 BEE8 7307

To claim this, I am signing this object:

@michaelnisi
michaelnisi / gist:f19bf39262ce11db4612
Last active Apr 18, 2019
Consume a JSON HTTP API in Swift
View gist:f19bf39262ce11db4612
// Consume a JSON HTTP API in Swift
import Foundation
struct Feed: Printable {
let author: String?
let image: String?
let language: String?
let link: String?
let summary: String?
@michaelnisi
michaelnisi / gist:7888690
Created Dec 10, 2013
Change remote origin URL of git repo.
View gist:7888690
git remote set-url origin git@github.com:user/repo.git
@michaelnisi
michaelnisi / gist:6095393
Created Jul 27, 2013
XCode header search path to expose static libraries in a workspace.
View gist:6095393
$(BUILT_PRODUCTS_DIR)/include/**
You can’t perform that action at this time.