This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// say that the object which is our _delegate is the only object retaining us | |
// and it calls this -processStuff method… | |
- (void)processStuff | |
{ | |
// and then this happens: | |
[_delegate finishedSomething:self]; | |
// now, in _delegate's -finishedSomething: it ends up releasing us like so: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We need more information to investigate this issue. | |
If this happens again: please check if turning off/on wifi resolves the issue? | |
Another thing that can be done is getting mDNSResponder logs: | |
1. Turn on verbose logging with | |
a) sudo syslog -c mDNSResponder -i | |
b) sudo killall -USR1 mDNSResponder | |
c) sudo killall -USR2 mDNSResponder | |
d) syslog -w > ~/Desktop/mDNS.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// uses PriorityQueue from https://github.com/mauriciosantos/Buckets-Swift | |
protocol Pathfinding { | |
typealias Node: Hashable | |
func neighborsFor(node: Node) -> [Node] | |
func costFrom(from: Node, to: Node) -> Int | |
func heuristicFrom(from: Node, to: Node) -> Int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing { | |
var something: Int? = nil | |
func doSomething() -> Int { | |
if something == nil { | |
something = 42 | |
} | |
return something * 2 // compiler complains because it thinks "something" might somehow not have a value in some case | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// translates a normalized texture coordinate into a normalized texture coordinate that has been "snapped" to the center of a pixel | |
vec2 nearest(vec2 uv, vec2 size) { | |
vec2 pixel = uv * size; | |
vec2 snapped = floor(pixel - 0.5) + 0.5; | |
return (snapped + step(0.5, pixel - snapped)) / size; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
An immutable structure-like value type for Lua. | |
Sean Heber (sean@fifthace.com) | |
BSD License | |
July, 2017 | |
Written on an iPad using Codea (https://codea.io) | |
I’m pretty new to Lua, but I kept running into situations where I wanted to use a complex value type | |
such as a Point as a key in a table. Unfortunately since each table instance is unique, using a table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Sean Heber on 9/26/19. | |
@import UIKit; | |
@interface KeyboardAwareContainerView : UIView | |
@property (nonatomic, readonly, nonnull) UIView *contentView; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typealias GeometricValue = Numeric & Comparable | |
struct GenericPoint<ValueType: GeometricValue>: Equatable { | |
var x: ValueType | |
var y: ValueType | |
static var zero: Self { Self(x: 0, y: 0) } | |
} | |
extension GenericPoint { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Sean Heber (@BigZaphod) on 10/12/19. | |
// License: BSD | |
import Foundation | |
//==--------------------------------------------------------- | |
/// This implementation requires the ability to initialize an | |
/// instance of a type before it can decode it. This is to support | |
/// reference types automatically so that each instance is | |
/// only stored once in the archive. Decoding a reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ReferenceEquatable: AnyObject, Equatable {} | |
extension ReferenceEquatable { | |
static func == (lhs: Self, rhs: Self) -> Bool { | |
return lhs === rhs | |
} | |
} | |
protocol ReferenceHashable: ReferenceEquatable, Hashable {} |
OlderNewer