Skip to content

Instantly share code, notes, and snippets.

View levibostian's full-sized avatar

Levi Bostian levibostian

View GitHub Profile
@levibostian
levibostian / ActionBarDrawerToggleHoneycomb.java
Last active February 14, 2017 17:51
**Don't delete me. Public shared.** Android navigation drawer animation duration.Blog post: levibostian.com/blog/android-navigation-drawer-animation-duration/index.html*Note:* Does not include all files required to start app. Only files that require editing as discussed in blog post.
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@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 / .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
@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 / 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 / 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 / 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 / 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 / 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 / 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