Skip to content

Instantly share code, notes, and snippets.

View surpher's full-sized avatar
📱

Marko Justinek surpher

📱
View GitHub Profile
@surpher
surpher / MockService+PactContracTests.swift
Last active October 5, 2021 07:04
Example PactSwift test verifying multiple interactions in one .run{ }
func testExample_AnimalsWithChildrenMultiple() {
let one = mockService
.uponReceiving("a request for animals with children")
.given("animals have children")
.withRequest(method: .GET, path: "/animals1")
.willRespondWith(
status: 200,
body: [
"animals": Matcher.EachLike(
[
@surpher
surpher / carthage-build
Created September 8, 2020 07:05
Xcode 12 carthage build workaround
#!/usr/bin/env bash
# Found at:
# - https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323
# - https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323
# carthage-build.sh
# Usage example: ./carthage-build.sh --platform iOS
set -euo pipefail
@surpher
surpher / rust_to_swift.md
Last active April 25, 2024 12:30
Building binaries from Rust to iOS/macOS (PactSwift specific)
@surpher
surpher / ViewControllerTests.swift
Created June 15, 2018 01:28
XCTest dismiss got called tapping UINavigationBar button
class ViewControllerTests: XCTestCase {
func testDismissGetsCalled() {
let sut = MockViewController()
sut.loadViewIfNeeded()
guard let dismissButton = sut.navigationItem.leftBarButtonItem else { XCTFail("should have a dismiss button"); return }
guard let action = dismissButton.action else { XCTFail("dismiss button should have an action"); return }
sut.performSelector(onMainThread: action, with: dismissButton, waitUntilDone: true)
@surpher
surpher / pact_publish.sh
Created May 18, 2018 22:59
Publish a Pact contract to a Pact Broker
#!/bin/bash -eu
##################################################################################
## Use pact-broker CLI tool instead of this script!
## https://github.com/pact-foundation/pact-ruby-standalone/releases
##################################################################################
## If for some reason can't use the pact-broker tool, the following could work...
## env vars:
## $pactBrokerAccount
## $pactBrokerUsername
## $pactBrokerPassword
@surpher
surpher / DyanmicTypeWithCustomFontExample.swift
Created May 18, 2018 22:51
Dynamic Type with Custom Font automatically applied on a subclassed UILabel
// With info gathered at https://stackoverflow.com/a/42235227/789720
import UIKit
// MARK: - Use
// set label to be of class MJLabel programmatically or in storyboards
// set the label to be of preferred dynamic type Title 1|Title 2|...|body|...
// MARK: - "Global" settings
struct MJBranding {
static let fontFamily: String = "Party LET"