Skip to content

Instantly share code, notes, and snippets.

View jeffaburt's full-sized avatar
🚀

Jeff Burt jeffaburt

🚀
View GitHub Profile
@jeffaburt
jeffaburt / prune_stale_appcenter_builds.sh
Created June 5, 2020 21:10
Remove stale AppCenter builds from the past (currently set to builds older than 15 days old)
#!/usr/bin/env sh
npm list -g appcenter-cli > /dev/null 2>&1
if [[ $? -ne 0 ]]
then
echo "Installing appcenter-cli..."
npm install -g appcenter-cli
fi
set -e
@jeffaburt
jeffaburt / PopupNavigationController.swift
Last active June 23, 2022 08:35
Popup Navigation Controller
import UIKit
class PopupNavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
commonInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
@jeffaburt
jeffaburt / ImageScaling.swift
Last active October 10, 2017 01:12
imageByScalingProportionallyToSize
import UIKit
extension UIImage {
/**
Returns a new UIImage instance by applying the new size.
- discussion: http://stackoverflow.com/a/2025413/1926015
- parameter targetSize: the new size
@jeffaburt
jeffaburt / EvenlyWrappedLabel.swift
Created October 10, 2017 00:29
EvenlyWrappedLabel
import UIKit
/**
A UILabel subclass that will vertically distribute text evenly across any
number of lines, preventing text from grouping up at the top.
Example:
(1)
This text:
@jeffaburt
jeffaburt / changes-between-last-two-tags.sh
Last active September 27, 2016 16:25
Gets the title of each pull request between the latest two tags
git log --pretty=%b `git describe --abbrev=0 HEAD^^`...`git describe --abbrev=0` --merges | grep '\S'
@jeffaburt
jeffaburt / UIView+Spinning.swift
Last active June 23, 2022 08:34
Allows any kind of UIView to start spinning in a 360 rotation
import UIKit
extension UIView {
func startSpinning() {
let spinAnimation = CABasicAnimation()
spinAnimation.fromValue = 0
spinAnimation.toValue = M_PI * 2
spinAnimation.duration = 2.5
spinAnimation.repeatCount = Float.infinity
spinAnimation.removedOnCompletion = false
@jeffaburt
jeffaburt / FadeWhenHighlightedButton.swift
Created August 8, 2016 18:45
It's really annoying that only the image fades when you tap on a button. By subclassing this, the entire button will fade.
import UIKit
class FadeWhenHiglightedButton: UIButton {
private var initialAlpha: CGFloat!
override var highlighted: Bool {
didSet {
alpha = highlighted ? initialAlpha - 0.4 : initialAlpha
}
}
@jeffaburt
jeffaburt / CGFloat+PixelConversion.swift
Last active December 31, 2023 12:32
Converts pixels to points based on the screen scale
import UIKit
public extension CGFloat {
/**
Converts pixels to points based on the screen scale. For example, if you
call CGFloat(1).pixelsToPoints() on an @2x device, this method will return
0.5.
- parameter pixels: to be converted into points
@jeffaburt
jeffaburt / DispatchAfterWithCancel.h
Created April 18, 2016 14:30
dispatch_after with the ability to cancel execution
//
// DispatchAfterWithCancel.h
//
// Created by Jeff Burt on 4/18/16.
// Copyright © 2016 Jeff Burt. All rights reserved.
//
#ifndef DispatchAfterWithCancel_h
#define DispatchAfterWithCancel_h