Skip to content

Instantly share code, notes, and snippets.

View aMoniker's full-sized avatar
💭
immanentizing

James Greenleaf aMoniker

💭
immanentizing
  • Viresco
  • New York, NY
View GitHub Profile
# Refresh the prompt every minute
periodic() {
source $THISFILE
}
PERIOD=60
# Assemble the full prompt and assign it to the ZSH PROMPT var
PROMPT=$'\n$PROMPT_TOP $FG[032]%~%{$reset_color%}\n$PROMPT_BOT '
# If we're outside the bounds of the start/end hours, show the sleeping dragon
if [[ $HOUR -gt $ENDHOUR || $HOUR -lt $STARTHOUR ]]; then
PROMPT_TOP=$DRAGON_SLEEP
PROMPT_BOT=$BED
else
# otherwise, show the burned and remaining clocks
for i in `seq $STARTHOUR $ENDHOUR`; do
if [[ $i -lt $HOUR ]]; then
PROMPT_TOP="$PROMPT_TOP$FIRE"
else
# time-dragon.zsh-theme
THISFILE=${BASH_SOURCE:-$0}
DRAGON="🐉"
DRAGON_SLEEP="🐲💤"
BED="🛏 "
FIRE='🔥'
CLOCKFACES=( 🕛 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 )
HOUR=`date +%H` # current hour
@aMoniker
aMoniker / time-dragon.sh
Last active March 28, 2018 23:22
Dragon Prompt
# time-dragon.zsh-theme
THISFILE=${BASH_SOURCE:-$0}
DRAGON="🐉"
DRAGON_SLEEP="🐲💤"
BED="🛏 "
FIRE='🔥'
CLOCKFACES=( 🕛 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 🕛 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 )
HOUR=`date +%H` # current hour

Keybase proof

I hereby claim:

  • I am amoniker on github.
  • I am amoniker (https://keybase.io/amoniker) on keybase.
  • I have a public key whose fingerprint is 9138 4181 14A3 8481 73C9 6AF0 D6C7 7B37 68D2 CD5A

To claim this, I am signing this object:

@aMoniker
aMoniker / useful-php-debug-functions.php
Last active August 29, 2015 14:01
Useful PHP Debug Functions
function pre_dump(/* whatever you like */) {
echo '<pre>';
call_user_func_array('var_dump', func_get_args());
echo '</pre>';
}
function die_dump(/* etc */) {
call_user_func_array('pre_dump', func_get_args());
die();
}
add_action('activated_plugin', function() {
$path = str_replace(WP_PLUGIN_DIR . '/', '', __FILE__);
if ($plugins = get_option('active_plugins')) {
if ($key = array_search($path, $plugins)) {
array_splice($plugins, $key, 1);
array_push($plugins, $path);
update_option('active_plugins', $plugins);
}
}
});
function pre_dump(/* whatever you like */) {
echo '<pre>';
call_user_func_array('var_dump', func_get_args());
echo '</pre>';
}