Skip to content

Instantly share code, notes, and snippets.

[
{
"iso2": "AF",
"translations": {
"br": "Afeganistão",
"nl": "Afghanistan",
"hr": "Afganistan",
"ja": "アフガニスタン",
"fr": "Afghanistan",
"it": "Afghanistan",
// works fine, but receiveValue may return on different threads
viewModel.$snapshot
.sink { [weak self] snapshot in
guard let self = self else { return }
var animateDifferences = false
switch self.viewModel.state {
case .idle, .empty, .loading, .searching:
animateDifferences = false
@colinhumber
colinhumber / step.swift
Last active April 4, 2019 22:17
Recursive Wizard Step
typealias SomeContent = String
indirect enum Step {
case step1(SomeContent, Step?)
case step2(SomeContent, Step?)
case step3(SomeContent, Step?)
}
let step1 = Step.step1("Step 1 data", nil)
let step2 = Step.step2("Step 2 data", step1)
@colinhumber
colinhumber / HackyNavBar
Created September 20, 2017 14:16
Hacky way to get a custom nav bar height
#import "SBBaseNavigationBar.h"
@interface SBBaseNavigationBar (iOS11HacksPrivate)
@property (nullable, nonatomic, readonly) UIView *navigationBarContentView;
@end
@colinhumber
colinhumber / gist:5a11de79075b1585d9bf
Created March 11, 2015 02:37
LLDB error using Swift Xcode 6.2
error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {
^~~~~~~~~~~~~~~
<EXPR>:11:5: error: use of unresolved identifier '$__lldb_injected_self'
$__lldb_injected_self.$__lldb_wrapped_expr_3(
^
### Keybase proof
I hereby claim:
* I am colinhumber on github.
* I am colinhumber (https://keybase.io/colinhumber) on keybase.
* I have a public key whose fingerprint is 0F25 9272 C700 B0BF BD75 E02A CB11 6A19 6150 22B2
To claim this, I am signing this object:
Not doing anything. The app just crashes every time it automatically or manually update the snippets.
Process: Xcode [29287]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.0.2 (3335.32)
Build Info: IDEApplication-3335032000000000~4
App Item ID: 497799835
App External ID: 106632651
Code Type: X86-64 (Native)
@colinhumber
colinhumber / gist:7205441
Created October 28, 2013 21:50
iOS tutorials for beginners
http://designthencode.com/scratch/
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html
http://www.raywenderlich.com/
https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/
@colinhumber
colinhumber / Image2Map.py
Last active December 20, 2015 22:18 — forked from bjorn/Image2Map.py
Python scripts for generating a tile set and tile map from an image. Modified to allow for transparency.
# Filename : Image2Map.py
# Authors : Georg Muntingh and Bjorn Lindeijer
# Version : 1.2
# Date : June 16, 2010
# Copyright : Public Domain
import os, sys, Image, networkx
class TileMap:
""" This class represents a map of tiles.
@colinhumber
colinhumber / gist:4674925
Created January 30, 2013 17:30
Add Git branch to your path in Terminal
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\[\033[m\]\w\[\033[0;36m\]$(parse_git_branch)\[\e[0m\]: '