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 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 / 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 / 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 / loop.sh
Last active April 20, 2020 16:28
CLI to run command until success, or timeout.
#!/bin/bash
# Script that executes a command until it succeeds or timesout.
# Usage: `./bin/loop.sh command-here`
# You can override the default parts of the script by:
# `SLEEP_TIME=1 MAX_TRIES=2 ./bin/loop.sh command-here`
#
# The script will send STDOUT message giving you an update on how things are going. The exit code of the command will be successful or failed depending on if the command succeeded before the timeout.
# Thanks, https://stackoverflow.com/a/12321815/1486374
@levibostian
levibostian / post.md
Last active April 15, 2020 20:31
webpack, Tachyons, pug, Vue.js web app.

Today, single page web apps are driving many websites that we use each and every day. Instead of having your browser request a new web page for each and every action you perform on a web page, single page web apps may load all in one request to smoothly and quickly transition with every action you perform.

When building single page web apps, you may decide to retrieve all of the HTML, CSS and Javascript with one single page load or dynamically load these resources as the user moves about your site. Either way, it can be a pain to bundle all of these assets together for the end user to download from your web server. This is where webpack comes into play.

webpack does all of the heavy lifting bundling all of your HTML, CSS and Javascript together. If you write your site all from scratch or depend on dependencies from npm, webpack takes care of packaging it all together for you. It has the ability to take your single page web app, cut out all of the code you don't need, then packa

@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 / 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 / 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