Skip to content

Instantly share code, notes, and snippets.

View joemasilotti's full-sized avatar
📱
Helping Rails developers build iOS and Android apps with Turbo Native.

Joe Masilotti joemasilotti

📱
Helping Rails developers build iOS and Android apps with Turbo Native.
View GitHub Profile
@joemasilotti
joemasilotti / Application.swift
Created February 28, 2020 17:45
Roll your own iOS dependency injection
protocol Injectable: class {
var router: Routable { get }
}
class Injector: Injectable {
lazy var router: Routable { Router() }()
}
protocol Routable {
func route(url: String)
@joemasilotti
joemasilotti / bootstrap4_breadcrumbs_builder.rb
Last active October 22, 2019 21:37 — forked from SaladFork/bootstrap4_breadcrumbs_builder.rb
`breadcrumbs_on_rails` builder with Bootstrap 4 compatible output
# `Bootstrap4BreadcrumbsBuilder `is a Bootstrap 4 (alpha6) compatible breadcrumb
# builder. It is designed to work with the `breadcrumbs_on_rails` gem as a
# drop-in builder replacement.
#
# Bootstrap4BreadcrumbsBuilder accepts a limited set of options:
#
# | option | default | description |
# | ---------------- | ------- | ------------------------------------------ |
# | `:container_tag` | `:ol` | What tag to use for the list container |
# | `:tag` | `:li` | What HTML tag to use for breadcrumb items |
@joemasilotti
joemasilotti / XcodeCheatSheet.md
Last active August 13, 2018 17:17
Xcode Cheat Sheet

##Xcode Locations

###Xcode Provisioning Profiles:

~/Library/MobileDevice/Provisioning\ Profiles

###Xcode Font and Color Schemes:

~/Library/Developer/Xcode/UserData/FontAndColorThemes
@joemasilotti
joemasilotti / Testing View Controllers in Swift 3.0
Last active September 10, 2017 22:39
Testing View Controllers in Swift 3.0
.
@joemasilotti
joemasilotti / URLSessionDataTaskProtocol.swift
Last active November 21, 2016 19:03
Trying to mock NSURLConnection
protocol URLSessionDataTaskProtocol {
func resume()
}
extension NSURLSessionDataTask: URLSessionDataTaskProtocol { }
@joemasilotti
joemasilotti / AddressFormatter.swift
Created March 27, 2016 20:44
AddressFormatter in Swift
import CoreLocation
struct AddressFormatter {
private let placemark: Placemarkable
init(placemark: Placemarkable) {
self.placemark = placemark
}
func formattedAddress() -> String {
@joemasilotti
joemasilotti / About.md
Last active February 25, 2016 22:16
NSDate Manipulation in iOS 8

This gist accompanies the blog post NSDate Manipulation Made Easy in iOS 8.

Apple quietly introduced a whole new suite of public API methods to NSCalendar in iOS 8 titled “Calendrical Calculations”. For some reason they seemed to have forgotten to include them in the public documentation on their developer site. Fortunately, digging in to the header file in Xcode reveals lots of descriptive comments about how to use these powerful new ways of interacting with NSDate objects.

@joemasilotti
joemasilotti / UITests.swift
Created January 5, 2016 14:15
Stubbing out repeating animations in UI Testing
import XCTest
class TestCase: XCTestCase {
let app = XCUIApplication()
override func setUp() {
super.setUp()
continueAfterFailure = false
app.launchArguments = ["UI-Testing"]
@joemasilotti
joemasilotti / MyPlayground.swift
Last active December 14, 2015 22:04
Swift Array to Dictionary
//: Playground - noun: a place where people can play
struct Option {
var id: UInt
var name: String
}
func combine(options: [Option]) -> [UInt: String] {
var combinedOptions = [UInt: String]()
for option in options {
@joemasilotti
joemasilotti / GuardFormatting.swift
Last active November 17, 2015 15:46
Which Swift guard formatting do you prefer?
//: Playground - noun: a place where people can play
enum Error: ErrorType {
case ParsingError
}
struct Person {
let name: String
let age: Int