Skip to content

Instantly share code, notes, and snippets.

View levibostian's full-sized avatar

Levi Bostian levibostian

View GitHub Profile
@levibostian
levibostian / README.md
Last active July 31, 2020 20:45
Coordinator pattern scenarios. For project: https://github.com/daveneff/Coordinator

Scenarios

This document gives you suggestions on how to handle different scenarios in your project and how can you use Coordinator in each scenario.

This document is meant to give you ideas. Remember, however, Coordinator is flexible. Solve each problem in a way that fits your app best.

Swap UIViewControllers

Let's say that you have a scenario where you are displaying a screen and after you are complete with that screen, you need to swap to another screen.

@levibostian
levibostian / AutoMockable.stencil
Created March 15, 2020 18:42
Sourcery advanced templates
// swiftlint:disable line_length
// swiftlint:disable variable_name
import RxSwift
import Foundation
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit
#elseif os(OSX)
import AppKit
#endif
@levibostian
levibostian / README.md
Last active February 19, 2021 22:56
Installing and managing Java on macOS. Handy for Android dev.

Android Studio comes with a SDK for java built in. You can use that as it defaults pretty easily. However, you may need more.

Installing java

We love homebrew. That is our preferred way of installing everything, including java. The instructions below are up to date as of the time of writing, but it may not work anymore. Check out this answer to get the latest tips on how to install java.

brew tap AdoptOpenJDK/openjdk
@levibostian
levibostian / howto.md
Last active April 18, 2023 10:30
How to run Ruby scripts from within XCode build phase script

It is assumed that you know what a XCode build phase is and how to create them. Create one, then follow the directions below to get it all working.

  • You may find more success from creating a bash script that executes ruby code then to copy/paste the ruby code directly into XCode's script box. This way you can use XCode as the place to setup your environment and then run the code in the ruby script you want to have executed.

To do this, it's quite simple. Create a new file in the root directory of your project. script.rb, for example.

Then, in your XCode build phase, keep the shell at it's default of /bin/sh and have the script run the ruby script:

./script.rb
@levibostian
levibostian / Foundation.swift
Created November 24, 2019 19:53
XCTest extensions
import Foundation
import XCTest
extension XCTest {
func XCTAssertNewer(_ newer: Date, _ older: Date, file: StaticString = #file, line: UInt = #line) {
XCTAssertGreaterThan(newer.timeIntervalSince1970, older.timeIntervalSince1970, "\(newer) is *not* newer then \(older)", file: file, line: line)
}
func XCTAssertOlder(_ older: Date, _ newer: Date, file: StaticString = #file, line: UInt = #line) {
XCTAssertGreaterThan(older.timeIntervalSince1970, newer.timeIntervalSince1970, "\(older) is *not* older then \(newer)", file: file, line: line)
@levibostian
levibostian / Contact.kt
Created June 20, 2019 14:13
Read contacts in Android
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
data class Contact(val contact_name: String,
val emails: List<String>?,
val phone_numbers: List<String>?): Parcelable
@levibostian
levibostian / log.txt
Last active March 4, 2019 19:30
kotlin crash - Cause: Back-end (JVM) Internal error: wrong code generated - Teller
Executing tasks: [:teller-android:generateDebugSources, :teller-android:compileDebugSources, :teller-android:createMockableJar, :teller-android:compileDebugUnitTestSources]
> Transform rxandroid.aar (io.reactivex.rxjava2:rxandroid:2.1.0) with JetifyTransform
> Transform multidex.aar (androidx.multidex:multidex:2.0.1) with JetifyTransform
> Task :teller-android:preBuild UP-TO-DATE
> Transform rxandroid.aar (io.reactivex.rxjava2:rxandroid:2.1.0) with ExtractAarTransform
> Task :teller-android:preDebugBuild UP-TO-DATE
> Transform multidex.aar (androidx.multidex:multidex:2.0.1) with ExtractAarTransform
> Transform rxandroid.aar (io.reactivex.rxjava2:rxandroid:2.1.0) with AarTransform
> Transform rxandroid.aar (io.reactivex.rxjava2:rxandroid:2.1.0) with AarTransform
@levibostian
levibostian / gist:f87dde57a72414b1b47347a8bf88e75e
Created April 3, 2018 15:38
Banned words Levi makes apps Twitch chat
anal
anus
arse
ballsack
balls
bastard
bitch
biatch
blowjob
blow job
@levibostian
levibostian / spdy_disabled_in_chrome
Created April 7, 2017 01:52 — forked from ankit-rakha/spdy_disabled_in_chrome
Google Chrome with SPDY disabled and set it to use System SSL
MAC OS X 10.8.3
$ cd /Applications/Google\ Chrome.app/Contents/MacOS
$ mv Google\ Chrome Chrome
Copy the following 2 lines:
#!/bin/sh
/Applications/Google\ Chrome.app/Contents/MacOS/Chrome --use-spdy=off --use-system-ssl
@levibostian
levibostian / .vimrc
Created April 5, 2017 18:51
My vimrc for Mark. In case he wants it.
" for 4 spaces indenting and auto-indent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
" for makefiles, use tabs instead of spaces:
if has ("autocmd")
filetype on
autocmd FileType make setlocal noexpandtab