Alias for Git sanity

Git command line is pretty confusing. Here are some aliases that I found helpful that normalize it with other command line commands and add a little bit better context:

$ git config --global alias.cd checkout
$ git config --global alias.ls branch
$ git config --global alias.delete-merged !git branch --merged | egrep -v "(^\*|master|development)" | xargs git branch -d
$ git config --global alias.stage add
$ git config --global alias.unstage reset HEAD

Hex

Here they are for not forgetting:

#cc9
#996
#663

Multi-line Text Ellipsis

CSS can only add ellipsis to a single line of text. Here’s how to do it in Javascript using lodash:

// Update wrapping text to limit the number of lines.
var maxLines = 2;
var textEls = document.getElementsByClassName('text-els-class');
var textMaxH = Math.ceil(textEls[0].getBoundingClientRect().height) * maxLines;

_.forEach(textEls, function(el) {

    el.style.whiteSpace = 'normal';

    var elH = el.getBoundingClientRect().height;
    var isOverflow = elH > textMaxH;
    var text = el.innerHTML;

    // Remove the last word until the height is within bounds.
    while (elH > textMaxH) {

        text = (text
            .split(' ')
            .slice(0,-1)
            .join(' ')
        );
        el.innerHTML = text;
        elH = el.getBoundingClientRect().height;
    }

    if (isOverflow) {
        title.innerHTML += ' ...';
        title.style.maxHeight = titleMaxH + 'px';
    }
});

Seven Tenets

  • Strive to act with compassion and empathy toward all creatures in accordance with reason.
  • The struggle for justice is an ongoing and necessary pursuit that should prevail over laws and institutions.
  • One’s body is inviolable, subject to one’s own will alone.
  • The freedoms of others should be respected, including the freedom to offend. To willfully and unjustly encroach upon the freedoms of another is to forgo your own.
  • Beliefs should conform to our best scientific understanding of the world. We should take care never to distort scientific facts to fit our beliefs.
  • People are fallible. If we make a mistake, we should do our best to rectify it and resolve any harm that may have been caused.
  • Every tenet is a guiding principle designed to inspire nobility in action and thought. The spirit of compassion, wisdom, and justice should always prevail over the written or spoken word.

Vacation Drink

  • 2 parts mango nectar
  • 2 part Malibu rum
  • 1 parts light rum
  • 1 part half and half
  • 2 drop vanilla extract

Shake over ice until frothy. Derve in a rocks. Garnish with fruits and a tiny umbrella.