Skip to content

Instantly share code, notes, and snippets.

View wilferrel's full-sized avatar

Wil Ferrel wilferrel

View GitHub Profile
@wilferrel
wilferrel / Dangerfile
Created March 23, 2018 13:03 — forked from candostdagdeviren/Dangerfile
Sample Dangerfile for iOS Project
# PR is a work in progress and shouldn't be merged yet
warn "PR is classed as Work in Progress" if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn "Big PR, consider splitting into smaller" if git.lines_of_code > 500
# Ensure a clean commits history
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
fail "Please rebase to get rid of the merge commits in this PR"
end
@wilferrel
wilferrel / Dangerfile
Created March 23, 2018 13:02 — forked from candostdagdeviren/Dangerfile
Sample Dangerfile for iOS Project
# PR is a work in progress and shouldn't be merged yet
warn "PR is classed as Work in Progress" if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn "Big PR, consider splitting into smaller" if git.lines_of_code > 500
# Ensure a clean commits history
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
fail "Please rebase to get rid of the merge commits in this PR"
end
@wilferrel
wilferrel / FutureVC
Last active December 6, 2017 20:39
VC Functional
static func showError(parentViewController: UIViewController, scenario: FastAppErrorScenario) -> Future<Void, WorkflowError> {
let promise = Promise<Void, WorkflowError>()
let errorVC = FastAppErrorScreen.instantiate(fastAppErrorScenario: scenario)
errorVC.promise = promise
let navControl = UINavigationController(rootViewController: errorVC)
parentViewController.show(navControl, sender: nil)
return promise.future
}

Videos

@wilferrel
wilferrel / uiappearance-selector.md
Created May 19, 2017 18:25 — forked from mattt/uiappearance-selector.md
A list of methods and properties conforming to `UIAppearance` as of iOS 8.0

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

@wilferrel
wilferrel / String.swift
Created March 7, 2017 01:53
Optionals and String Interpolation
infix operator ???: NilCoalescingPrecedence
public func ???<T>(optional: T?, defaultValue: @autoclosure () -> String) -> String {
switch optional {
case let value?: return String(describing: value)
case nil: return defaultValue()
}
}
@wilferrel
wilferrel / iOSCreatePDF.swift
Created February 28, 2017 15:57 — forked from nyg/iOSCreatePDF.swift
iOS, Swift: Create a PDF file from an HTML string
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer
import UIKit
// 1. Create a print formatter
let html = "<b>Hello <i>World!</i></b>"
let fmt = UIMarkupTextPrintFormatter(markupText: html)
// 2. Assign print formatter to UIPrintPageRenderer
@wilferrel
wilferrel / meldium_to_1password.py
Created October 24, 2016 18:42 — forked from tals/meldium_to_1password.py
Meldium to 1Password converter
"""
1Password is good at a lot of things. Importing CSV is not one of them (as of 5.5.BETA-29).
Converts a Meldium CSV to something 1Password will import correctly.
To export: http://support.meldium.com/knowledgebase/articles/656755-export-meldium-data-to-a-spreadsheet
"""
import csv
import sys
#
# Be sure to run `pod lib lint Moya-SwiftyJSONMapper.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "Moya-SwiftyJSONMapper"
{
"name": "ReactiveCocoa",
"version": "4.2.2",
"summary": "A framework for composing and transforming streams of values.",
"description": "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming.\nIt provides APIs for composing and transforming streams of values.",
"homepage": "https://github.com/ReactiveCocoa/ReactiveCocoa",
"license": {
"type": "MIT",
"file": "LICENSE.md"
},