I hereby claim:
- I am justin on github.
- I am justinwme (https://keybase.io/justinwme) on keybase.
- I have a public key ASDBnz525aVsN7y7rHcRDjMt2ZOyhPTwUniM0mSxrtJpzwo
To claim this, I am signing this object:
#!/usr/bin/env zsh | |
# | |
# Convenience wrapper around the simctl command to perform operations related to iOS simulators. | |
# Author: Justin Williams (@justin) | |
# | |
# Usage: sim <options> <subcommand> | |
# | |
# This script is designed to work with ZSH. ymmv with other shells. | |
set -e |
typedef void (^SGBlock)(); | |
@interface NSTimer (Blocks) | |
+ (id)scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)shouldRepeat block:(SGBlock)block; | |
+ (id)timerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)shouldRepeat block:(SGBlock)block; | |
@end | |
#!/bin/zsh | |
# | |
# Check for the existence of an .xcoderc in the root of a project and update the DEVELOPER_DIR | |
# to point to that specific version of Xcode. Update Carthage dependencies as well. | |
# | |
# This is useful for all the switching between Xcode 10.x and 11.x as I am doing presently. | |
# | |
# Usage: | |
# xcode_switch [--no-bootstrap] [version_number] | |
# |
#import <Foundation/Foundation.h> | |
@interface NSObject (FancyDescription) | |
// | |
// Output the values of all the properties associated with a given class. | |
// Iterates all the way down the chain until we hit NSObject. | |
// | |
- (NSString *)sg_description; |
I hereby claim:
To claim this, I am signing this object:
NSUInteger numberOfSegments = [self numberOfSegments]; | |
CGFloat segmentWidth = CGRectGetWidth(self.bounds) / numberOfSegments; | |
CGFloat segmentHeight = CGRectGetHeight(self.bounds); | |
UIAccessibilityElement *element = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:self]; | |
element.isAccessibilityElement = YES; | |
CGRect segmentFrame = CGRectMake(i * segmentWidth, 0, segmentWidth, segmentHeight); | |
element.accessibilityFrame = [self.window convertRect:segmentFrame fromView:self]; | |
UIAccessibilityTraits traits = UIAccessibilityTraitAllowsDirectInteraction; | |
if (i == [self selectedSegmentIndex]) | |
{ |
#import <UIKit/UIKit.h> | |
@interface UIImageView (SGExtensions) | |
- (CGRect)sg_imageFrame; | |
@end |
- (UIAccessibilityTraits)accessibilityTraits | |
{ | |
UIAccessibilityTraits traits = UIAccessibilityTraitButton | UIAccessibilityTraitAllowsDirectInteraction | UIAccessibilityTraitStaticText; | |
if (self.disabled == YES) | |
{ | |
traits = traits | UIAccessibilityTraitNotEnabled; | |
} | |
return traits; |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI)) | |
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI) | |
#define ARC4RANDOM_MAX 0x100000000 | |
double startingLatitude = DEGREES_TO_RADIANS(39.753638); | |
double startingLongitude = DEGREES_TO_RADIANS(-105.007375); | |
double earthRadius = 3960.056052; | |
double maxdist = 50.0f; |