Skip to content

Instantly share code, notes, and snippets.

/* make the filters a bit more compact */
.ghx-controls-filters dt {
margin: 0;
}
.ghx-controls-filters dd {
margin: 0;
font-size: 12px;
}
@jonathan-beebe
jonathan-beebe / ios_memory_leaks.md
Created December 22, 2016 17:30
Memory Leaks in iOS

Blocks that are added to a notification center

typeof(self) __weak weakSelf = self;
[[[EDFlux sharedInstance] budgetStore] addChangeObserverWithBlock:^(NSNotification* note) {
    [weakSelf doSomething];
}];
@jonathan-beebe
jonathan-beebe / swift-to-objc-bool-bridge.m
Created December 22, 2016 15:41
Bridging an optional bool from Swift to Objective-C
@implementation MyObjcClass
. . .
if(mySwiftClassInstance.hasFeatureBridged == nil) {
// handle nil case
}
else if(mySwiftClassInstance.hasFeatureBridged boolValue] == YES) {
// handle true case
}
@jonathan-beebe
jonathan-beebe / Garmin Connect IQ Custom Drawable
Last active December 13, 2021 21:27
Garmin Connect IQ Custom Drawable
A sample of creating a custom drawable, both in xml and via code.
@jonathan-beebe
jonathan-beebe / README.md
Last active April 13, 2021 13:42
git: Find all merged ancestors branches and create commands to delete them.

To find all ancestor branches

./get_ancestor_branches.sh

To create the delete commands for all ancestor branches and echo them as text (not invoking them)

@jonathan-beebe
jonathan-beebe / async_xctest.swift
Created July 20, 2016 14:30
A template for async swift tests
import XCTest
@testable import {AppTarget}
class TestCase: XCTestCase {
func testCode() {
let expectation = expectationWithDescription("test description")
var result: Bool?
// Setup the the test here
@jonathan-beebe
jonathan-beebe / fix-nokogiri.sh
Created July 14, 2016 23:56
Fixing nokogiri on OS X 10.12 El Capitan
gem install nokogiri -v '1.6.8' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
@jonathan-beebe
jonathan-beebe / LocalizableButton.swift
Last active October 24, 2017 18:48
Localizable views in xib or storyboards
import UIKit
/// Implements a UIButton that can be localized within a xib or storyboard.
/// To render a localized string set a “User defined runtime attribute” on
/// the view with a key path of `localizableStringKey` and a string value of
/// the localized string key.
class LocalizableButton: UIButton {
var localizableStringKey: String? {
didSet {
@jonathan-beebe
jonathan-beebe / async_helpers.swift
Created May 16, 2016 16:38
Helpers to make dispach_* code in Swift a bit more concise.
import Foundation
func async(callback:(Void -> Void)) {
dispatch_async(dispatch_get_main_queue(), { () -> Void in
callback()
})
}
func after(delay:Double, closure:Void->Void) {
dispatch_after(
@jonathan-beebe
jonathan-beebe / UICTContentSizeCategory
Created February 5, 2016 22:05
UICTContentSizeCategory logs for each category
```
UICTContentSizeCategoryXS
Caption 1 = {size: 11pts, weight:normal}
default = {size: 13pts, weight:normal}
Body = {size: 14pts, weight:normal}
Subhead = {size: 12pts, weight:normal}
Title 1 = {size: 25pts, weight:normal}