Skip to content

Instantly share code, notes, and snippets.

@brynbodayle
brynbodayle / SKSceneWithUserInteractionBugfix.swift
Created February 14, 2019 04:20
SKScene UserInteraction Bug Fix
//
// Original Objective C version: https://gist.github.com/bobmoff/7110052
//
// Fix SpriteKit's SKNode bug on iOS 7 & 8: nodes capture touch events
// even when userInteractionEnabled is false and the nodes are hidden.
//
// Details:
// http://stackoverflow.com/questions/19511334/sprite-with-userinteractionenabled-set-to-yes-does-not-receive-touches-when-cove
//
// How to use:
@brynbodayle
brynbodayle / gist:de70eb6a392e90272707
Created July 25, 2014 16:29
Multiline UIButton + Auto Layout
- (CGSize)intrinsicContentSize {
CGSize boundingSize = CGSizeMake(self.titleLabel.preferredMaxLayoutWidth - self.titleEdgeInsets.left - self.titleEdgeInsets.right, CGFLOAT_MAX);
NSAttributedString *attributedTitle = [self attributedTitleForState:self.state];
CGRect boundingRect;
if(attributedTitle) {
@brynbodayle
brynbodayle / gist:8907585
Created February 9, 2014 23:15
AppleScript to set the position and size of a window.
tell application "System Events" to tell application process "Safari"
try
get properties of window 1
set position of window 1 to {438, 22}
set size of window 1 to {1669, 1418}
on error errmess
log errmess
-- no window open
end try
end tell
@brynbodayle
brynbodayle / gist:7522244
Created November 18, 2013 03:58
Fix for UILabel attributedPlaceholder not allowing a placeholder font different than the label's text font.
#import "CustomTextField.h"
@interface CustomTextField()
@property (nonatomic, strong) NSAttributedString *originalAttribtuedPlaceholder;
@end
@implementation CustomTextField