Skip to content

Instantly share code, notes, and snippets.

View michaelnisi's full-sized avatar
🌐

Michael Nisi michaelnisi

🌐
View GitHub Profile
@michaelnisi
michaelnisi / gist:f19bf39262ce11db4612
Last active July 21, 2023 13:49
Consume a JSON HTTP API in Swift
// 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 / update_settings
Last active August 6, 2020 21:01
Updating the version number in a iOS settings bundle
#!/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 / ReportCrash
Created August 1, 2019 08:44
The app was killed due to memory reasons
default 2019-07-17 15:33:36.771581 +0200 ReportCrash Process MyApp [24519] killed by jetsam reason per-process-limit
@michaelnisi
michaelnisi / configure_otp.sh
Last active February 10, 2019 08:45
Configure Erlang/OTP build on macOS with pkgin
./configure --without-javac --without-odbc --with-ssl=/opt/pkg
@michaelnisi
michaelnisi / tokens.swift
Created September 9, 2018 04:41
Persisting Change Tokens for CloudKit Sync
// 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 / gist:7888690
Created December 10, 2013 10:38
Change remote origin URL of git repo.
git remote set-url origin git@github.com:user/repo.git
@michaelnisi
michaelnisi / gist:6095393
Created July 27, 2013 16:35
XCode header search path to expose static libraries in a workspace.
$(BUILT_PRODUCTS_DIR)/include/**
@michaelnisi
michaelnisi / gist:5645933
Created May 24, 2013 19:27
Hex to RGB macro for Objective-C
#define RGB(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16)) / 255.0 \
green:((float)((hex & 0xFF00) >> 8)) / 255.0 \
blue:((float)(hex & 0xFF)) / 255.0 \
alpha:1.0]
@michaelnisi
michaelnisi / install.sh
Created November 17, 2012 18:32
Install Node on Amazon Linux AMI
#!/bin/sh
sudo yum update
sudo yum install gcc-c++
sudo yum install git
git clone git://github.com/joyent/node.git
cd node
git checkout v0.8.14
@michaelnisi
michaelnisi / gist:3945325
Created October 24, 2012 10:14
Uninstall Google Software Updater
sudo /Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/GoogleSoftwareUpdateAgent.app/Contents/Resources/install.py --uninstall