Skip to content

Instantly share code, notes, and snippets.

View CJBridges's full-sized avatar

CJ Bridges CJBridges

  • Asurion
View GitHub Profile
@CJBridges
CJBridges / circleci_command_for_cache_optimization.yml
Last active January 22, 2024 18:56
CircleCI does not support checks for existence of a cache key without restoring the full cache. Save a tiny key in parallel with the cache to allow bailing out faster if the cache already exists. More documentation on the approach and the code I started from (thanks TzookB!) is here: https://tzookb.com/circleci-project-deepdive
commands:
halt_if_cache_exists:
description: Halt a build if a cache already exists, without downloading the entire cache. Match only exact key. Pair with mark_cache_existence.
parameters:
category:
description: friendly name of the sort of cache (e.g. bundle, src)
type: string
key:
description: hash key where underlying data would be stored
@CJBridges
CJBridges / my_prompt
Last active August 29, 2015 14:14
This is a favorite prompt of mine.
. /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh # for git_ps1 below
my_prompt() {
if [ $? -eq 0 ]; then
RC=""
RC_COLOR_FOR_PROMPT=$DF
else
RC="[$?]"
RC_COLOR_FOR_PROMPT=$RED
fi