Skip to content

Instantly share code, notes, and snippets.

View hereisderek's full-sized avatar
😐
- =

Derek Zhu hereisderek

😐
- =
View GitHub Profile
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
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;
@CliffordAnderson
CliffordAnderson / brew-install-script.sh
Last active February 14, 2024 08:29
Brew script for installing packages and applications on OSX
#!/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
@geoff-nixon
geoff-nixon / osx-software-update-urls.txt
Created September 23, 2015 08:04 — forked from stefanschmidt/osx-software-update-urls.txt
URLs of the index files used by the software update client on OS X
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
@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active October 10, 2023 12:21
Script to install stuff I want on a new OSX machine
#!/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)