Skip to content

Instantly share code, notes, and snippets.

Avatar

Curtis Herbert parrots

View GitHub Profile
@parrots
parrots / ModernSegmentedControl.swift
Created Jun 28, 2019
A segmented control without the borders. Allows for a subtle background on the unselected states, and a tint on the selected state.
View ModernSegmentedControl.swift
//
// ModernSegmentedControl.swift
//
//
// Created by Curtis Herbert on 3/8/18.
//
import Foundation
@objc final class ModernSegmentedControl: UIControl {
@parrots
parrots / AsyncOperation.swift
Last active May 17, 2021
A Swifty version of an AsyncOperation which solves two common problems I ran into. (see comment below for issues addressed)
View AsyncOperation.swift
//
// AsyncOperation.swift
// Slopes
//
import Foundation
class AsyncOperation: Operation {
private let stateLock = NSLock()
private var observers: [NSKeyValueObservation] = [NSKeyValueObservation]()
View keybase.md

Keybase proof

I hereby claim:

  • I am parrots on github.
  • I am parrots (https://keybase.io/parrots) on keybase.
  • I have a public key whose fingerprint is 43FD FA59 6C6F 3419 9FC5 4702 9D99 E4DB 59AD B11F

To claim this, I am signing this object:

View CachingInterfaceController.h
@import WatchKit;
@interface CachingInterfaceController : WKInterfaceController
- (void)updateLabel:(WKInterfaceLabel *)label withString:(NSString *)string;
- (void)updateLabel:(WKInterfaceLabel *)label asHidden:(BOOL)hidden;
- (void)updateImage:(WKInterfaceImage *)image withImageNamed:(NSString *)imageName;
- (void)updateImage:(WKInterfaceImage *)image withBaseNameForAnimation:(NSString *)baseName withRange:(NSRange)range duration:(NSTimeInterval)duration repeatCount:(NSInteger)repeatCount;
- (NSString *)currentImageNameForImage:(WKInterfaceImage *)image;
@parrots
parrots / versioning.sh
Created Apr 9, 2015
Watchkit versioning build phase
View versioning.sh
git=`sh /etc/profile; which git`
branch_name=`$git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,'`
git_count=`$git rev-list $branch_name |wc -l | sed 's/^ *//;s/ *$//'`
simple_branch_name=`$git rev-parse --abbrev-ref HEAD`
build_number="$git_count"
if [ $CONFIGURATION != "Release" ]; then
build_number+="-$simple_branch_name"
fi
@parrots
parrots / CBCImageView
Created Dec 17, 2014
Work around IB_Designable bug with template images and Interface Builder
View CBCImageView
@import UIKit;
IB_DESIGNABLE @interface CBCImageView : UIImageView
@end
@implementation CBCImageView
- (void)awakeFromNib
{
@parrots
parrots / hack.sh
Last active Jan 23, 2019 — forked from DAddYE/hack.sh
OSX Defaults
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
#echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
#defaults write NSGlobalDomain AppleKeyboardUIMode -int 3