Skip to content

Instantly share code, notes, and snippets.

@dpkirchner
dpkirchner / gist:8682a21130d8a5de313793b8bdb8d16a
Created October 23, 2017 16:19
how to vertically center a TextInputLayout's TextInputEditText without disabling hints
TextInputLayout adds a top margin to the TextInputEditText to reserve space for the collapsing hint.
That effectively breaks vertical centering. This code simply copies the newly set top margin to the
bottom.
(Note that this isn't fully tested with all languages. The hint height is set based on font
characteristics. If you have a font with really large descenders and small ascenders you may
need to make changes to this code.
For reference, see TextInputLayout's updateInputLayoutMargins)
@dpkirchner
dpkirchner / verbose_output.txt
Created October 2, 2014 13:31
Verbose output of the Ansible-not-pipelining-ssh work
# output from playbook: https://gist.github.com/dpkirchner/c5092daa208df081fc25
creating host via 'add_host': hostname=1.2.3.4
added host to group via add_host module: foo
ok: [localhost] => {"new_groups": ["foo"], "new_host": "1.2.3.4"}
PLAY [Do the do] **************************************************************
TASK: [thing one] *************************************************************
<1.2.3.4> ESTABLISH CONNECTION FOR USER: dpk
@dpkirchner
dpkirchner / playbook.yaml
Created October 2, 2014 13:27
Playbook that demonstrates ssh pipelining not working as expected
- name: Make a host list
hosts: localhost
gather_facts: no
connection: local
tasks:
- name: add host
add_host: hostname=1.2.3.4 groupname=foo
- name: Do the do
@dpkirchner
dpkirchner / .bashrc
Last active December 14, 2016 18:01 — forked from henrik/.bashrc
Got tired of leaving stashes lying around.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# username@Machine ~/dev/dir[master*] (stashes 2)$ # dirty working dir plus there are some stashes
function parse_git_dirty {
[ ! -z "$(git status --porcelain 2> /dev/null)" ] && echo "*"
}
# http://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch