Skip to content

Instantly share code, notes, and snippets.

View joshdholtz's full-sized avatar
👨‍👩‍👦
Family first then OSS

Josh Holtz joshdholtz

👨‍👩‍👦
Family first then OSS
View GitHub Profile
@joshdholtz
joshdholtz / Snapfile
Created January 15, 2015 21:47
Hangning on instruments
# A list of devices you want to take the screenshots from
devices([
"iPhone 6",
"iPhone 6 Plus",
"iPhone 5",
"iPhone 4s"
])
languages([
'en-US'
@joshdholtz
joshdholtz / associations.ex
Created December 28, 2014 18:45
Cause I'm lazy
# How to use
e = Repo.get(Exercise, 1)
user = Exercise.get_user(e)
defmodule GymOclock.Exercise do
use Ecto.Model
# Other stuff here
def get_user(exercise) do
@joshdholtz
joshdholtz / hmm.ex
Last active August 29, 2015 14:12
Pattern match on empty map
errors = %{}
case map_size(errors) do
0 ->
# Do good stuff
_ ->
# Do bad stuff
end
- (BOOL)isNowAGoodTimeForADrink {
return YES;
}
@joshdholtz
joshdholtz / thing.rs
Created November 21, 2014 20:37
Trying to back a callback in an enum
enum Thing {
Something {
callback: |f32| // error: explicit lifetime bound required
},
Nothing {
callback: |str| // error: explicit lifetime bound required
}
}
@joshdholtz
joshdholtz / something.m
Last active August 29, 2015 14:09
Autoconstraint issue
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x17009cb60 UIImageView:0x1701f9900.centerX == AVAudioOnlyIndicatorView:0x170199980.centerX>",
"<NSLayoutConstraint:0x17009cbb0 H:|-(>=10)-[UIImageView:0x1701f9900] (Names: '|':AVAudioOnlyIndicatorView:0x170199980 )>",
"<NSLayoutConstraint:0x17009d970 H:|-(0)-[AVAudioOnlyIndicatorView:0x170199980] (Names: '|':UIView:0x17419a4e0 )>",
"<NSLayoutConstraint:0x17009d9c0 H:[AVAudioOnlyIndicatorView:0x170199980]-(0)-| (Names: '|':UIView:0x17419a4e0 )>",
"<NSLayoutConstraint:0x17009d6f0 H:|-(0)-[UIV
@joshdholtz
joshdholtz / SwiftGenericFactory.swift
Created October 17, 2014 03:20
Swift Generic Factory
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / Working.swift
Last active August 29, 2015 14:07
Working Version
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / ManStuff.swift
Created October 15, 2014 19:21
Another issues but with extending???
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / GenericsThings.swift
Created October 15, 2014 19:03
Why is C not C?
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit