Skip to content

Instantly share code, notes, and snippets.

Amber Star amberstar

Block or report user

Report or block amberstar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@douglashill
douglashill / KeyboardTableView.swift
Last active Sep 8, 2019
A UITableView that allows navigation and selection using a hardware keyboard.
View KeyboardTableView.swift
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
var selectAboveDiscoverabilityTitle: String?
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active Jul 24, 2019
A real world usage for git subtrees.
View example-subtree-usage.md

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@marcoarment
marcoarment / gist:1105553afba6b4900c10
Created Oct 21, 2014
Variable-height UITableView tableHeaderView with autolayout
View gist:1105553afba6b4900c10
// in a UITableViewController (or any other view controller with a UITableView)
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, 0)];
header.translatesAutoresizingMaskIntoConstraints = NO;
// [add subviews and their constraints to header]
NSLayoutConstraint *headerWidthConstraint = [NSLayoutConstraint
View Format code script for Xcode
#!/bin/sh
~/Applications/UniversalIndentGUI/indenters/uncrustify -l OC -q -c ~/Applications/UniversalIndentGUI/config/uncrustify_obj_c.cfg
@CodaFi
CodaFi / Free.swift
Created Sep 20, 2014
Free Monads in Swift
View Free.swift
//
// Free.swift
// Swift_Extras
//
// Created by Robert Widmann on 9/19/14.
// Copyright (c) 2014 Robert Widmann. All rights reserved.
//
import Foundation
View Cluster.swift
class Number /* class cluser */ {
class Int8: Number {
var value: Swift.Int8
init(_ value: Swift.Int8) { self.value = value }
}
class Int: Number {
var value: Swift.Int
init(_ value: Swift.Int) { self.value = value }
}
@mackworth
mackworth / Obectivej-C to Swift Syntax Translation.md
Last active Oct 13, 2017
Table showing the major translations from Objective-C to Swift syntax
View Obectivej-C to Swift Syntax Translation.md

Conversion Process from Objective-C syntax to Swift The most important first step is to run Apple's "Convert to Modern Objective-C Syntax" refactoring, so that you're using array/dictionary literals and bracket-accesses; these will then be usable in Swift. Note also that I'm a beginner in Swift, so my apologies for any mistakes or incompleteness here.

When you see this pattern Replace with this
Module
@interface *newType* : *superType* <*protocol1*, *protocol2*> class *newType* : *superType*, *protocol1*, *protocol2*
@implementation OR @synthesize OR @end Delete
Properties
@davedelong
davedelong / UpdateRepositories.swift
Last active Jan 30, 2017
A headless Swift program that keeps a directory of git repositories up-to-date
View UpdateRepositories.swift
#!/usr/bin/swift
import Foundation
func scanForRepositories(directory: NSURL, root: NSURL) {
let fileManager = NSFileManager.defaultManager()
let options: NSDirectoryEnumerationOptions = .SkipsSubdirectoryDescendants | .SkipsPackageDescendants
if let contents = fileManager.contentsOfDirectoryAtURL(directory, includingPropertiesForKeys: [NSURLIsDirectoryKey], options: options, error: nil) {
let urls = contents as Array<NSURL>
View App Store Refund
You can get a refund for any app on the App Store by following this process:
1. Visit https://reportaproblem.apple.com
2. Sign In with your Apple ID.
3. Click “Report a Problem” on the offending app.
4. Choose “Problem is not listed here” and be sure to mention that you are asking for a refund because it doesn’t work as expected.
You can’t perform that action at this time.