Skip to content

Instantly share code, notes, and snippets.

Joe Masilotti joemasilotti

Block or report user

Report or block joemasilotti

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
@joemasilotti
joemasilotti / bootstrap4_breadcrumbs_builder.rb
Last active Oct 22, 2019 — forked from SaladFork/bootstrap4_breadcrumbs_builder.rb
`breadcrumbs_on_rails` builder with Bootstrap 4 compatible output
View bootstrap4_breadcrumbs_builder.rb
# `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 / ..md
Last active Jan 27, 2020
Resetting NSUserDefaults in UI Testing
View ..md

Resetting NSUserDefaults in UI Testing

  1. Add "UI-Testing" to launchArguments before launching the app under test
  2. On launch, check for the argument in AppDelegate.swift
  3. If it exists remove everything for the app's domain from NSUserDefaults
View AddressFormatter.swift
import CoreLocation
struct AddressFormatter {
private let placemark: Placemarkable
init(placemark: Placemarkable) {
self.placemark = placemark
}
func formattedAddress() -> String {
@joemasilotti
joemasilotti / UITests.swift
Created Jan 5, 2016
Stubbing out repeating animations in UI Testing
View UITests.swift
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 Dec 14, 2015
Swift Array to Dictionary
View MyPlayground.swift
//: 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 Nov 17, 2015
Which Swift guard formatting do you prefer?
View GuardFormatting.swift
//: Playground - noun: a place where people can play
enum Error: ErrorType {
case ParsingError
}
struct Person {
let name: String
let age: Int
@joemasilotti
joemasilotti / URLSessionDataTaskProtocol.swift
Last active Nov 21, 2016
Trying to mock NSURLConnection
View URLSessionDataTaskProtocol.swift
protocol URLSessionDataTaskProtocol {
func resume()
}
extension NSURLSessionDataTask: URLSessionDataTaskProtocol { }
@joemasilotti
joemasilotti / UITest.swift
Created Sep 17, 2015
How to assert if a view is off screen
View UITest.swift
import XCTest
class UITests: XCTestCase {
let app = XCUIApplication()
override func setUp() {
super.setUp()
continueAfterFailure = false
app.launch()
}
You can’t perform that action at this time.