Skip to content

Instantly share code, notes, and snippets.

View chrisnolet's full-sized avatar

Chris Nolet chrisnolet

View GitHub Profile
@chrisnolet
chrisnolet / .zshrc
Last active April 13, 2024 06:13
Color-coded git branch for zsh prompt
autoload -Uz compinit && compinit
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f"
zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a"
zstyle ':vcs_info:*' stagedstr "%F{green}"
@chrisnolet
chrisnolet / yesterbox.js
Last active May 20, 2018 23:12
Yesterbox for Gmail (Google Apps Script)
function yesterbox() {
var yesterboxName = "Yesterbox";
var backlogName = "Backlog";
var cutoffHour = 7; // 7am each day
var backlogCutoffDays = 10; // Older than 10 days
var yesterboxLabel = GmailApp.getUserLabelByName(yesterboxName) || GmailApp.createLabel(yesterboxName);
var backlogLabel = GmailApp.getUserLabelByName(backlogName) || GmailApp.createLabel(backlogName);
var yesterboxCutoff = new Date();
@chrisnolet
chrisnolet / .bash_profile
Last active September 27, 2022 13:37 — forked from henrik/.bashrc
Color-coded git branch for bash prompt
git_branch() {
local branch=$(git --no-optional-locks branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* (*\([^)]*\))*/\1/')
if [[ -n $branch ]]; then
if [[ -z $(git --no-optional-locks status --porcelain 2> /dev/null) ]]; then
echo -e " \001\033[32m\002($branch)\001\033[0m\002"
else
echo -e " \001\033[31m\002($branch)\001\033[0m\002"
fi
fi