Skip to content

Instantly share code, notes, and snippets.

View nschwermann's full-sized avatar
:shipit:

Nathan Schwermann nschwermann

:shipit:
View GitHub Profile
@nschwermann
nschwermann / .bash_profile
Last active December 14, 2015 19:19 — forked from jimothyGator/.bash_profile
Display current Git branch and root directory in Mac OS X Terminal title bar.
# Add to .bash_profile
cd () {
builtin cd "$@"
update_title
}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
/*
* Copyright (C) 2014 Chris Banes
*
* 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
/*
* Copyright 2014 Google Inc.
*
* 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
/**
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable).
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while
* the alpha values are derived from the source's grayscaled RGB values. The effect is that
* you can see through darker parts of the source bitmap, while lighter parts show up as
* the given color. The 'invert' argument inverts the computation of alpha values, and looks
* best when the given color is a dark.
*/
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) {
int width = src.getIntrinsicWidth();
@nschwermann
nschwermann / DesignSupport.kt
Last active November 22, 2020 06:38 — forked from mgranberry/DesignSupport.kt
collection of kotlin extensions for android development
package org.jetbrains.anko
import android.app.Activity
import android.support.annotation.StringRes
import android.support.design.widget.*
import android.support.v4.app.Fragment
import android.view.View
import android.view.ViewManager
import java.util.concurrent.atomic.AtomicInteger