This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class Optional<out T: Any> { | |
abstract val isPresent: Boolean | |
} | |
object None : Optional<Nothing>() { | |
override val isPresent: Boolean = false | |
} | |
data class Some<T: Any>(val value: T) : Optional<T>() { | |
override val isPresent: Boolean = true | |
} | |
fun <T: Any> T?.asOptional(): Optional<T> = this?.let(::Some) ?: None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.Resources; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.LightingColorFilter; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Homebrew Script for OSX | |
# To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh` | |
echo "Installing brew..." | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
echo "Installing brew cask..." | |
brew tap homebrew/cask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10.3 (Panther): | |
https://swscan.apple.com/scanningpoints/scanningpointX.xml | |
10.4 (Tiger): | |
https://swscan.apple.com/content/catalogs/index.sucatalog | |
https://swscan.apple.com/content/catalogs/index-1.sucatalog | |
10.5 (Leopard): | |
https://swscan.apple.com/content/catalogs/others/index-leopard.merged-1.sucatalog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Bootstrap script for setting up a new OSX machine | |
# | |
# This should be idempotent so it can be run multiple times. | |
# | |
# Some apps don't have a cask and so still need to be installed by hand. These | |
# include: | |
# | |
# - Twitter (app store) |