<commit_before>export CODEPATH=~/code

function project() {
  users=(heroku dmathieu)

  if [ ${1[(ws:/:)1]} != ${1[(ws:/:)2]} ]; then
    stickyUser=${1[(ws:/:)1]}
    projectName=${1[(ws:/:)2]}
  else
    stickyUser=
    projectName=$1
  fi

  for user in $users; do
    if [[ -z $stickyUser || $stickyUser == $user ]]; then
      dir=$CODEPATH"/src/github.com/"$user"/"$projectName

      if [[ -d $dir ]]; then
        cd $dir
        return
      fi
    fi
  done

  for user in $users; do
    if [[ -z $stickyUser || $stickyUser == $user ]]; then
      apiUri="https://api.github.com/repos/"$user"/"$projectName
      gitUri="https://github.com/"$user"/"$projectName".git"
      code=`curl -n -o /dev/null --silent --head --write-out '%{http_code}\n' $apiUri`

      if [[ $code == 200 ]]; then
        dir=$CODEPATH"/src/github.com/"$user"/"$projectName
        git clone $gitUri $dir
        cd $dir
        return
      fi
    fi
  done

  echo "Couldn't find any project '$1'. Did you mistype it?"
}


alias p="project"
<commit_msg>fetch the latest version when going into a known project<commit_after>export CODEPATH=~/code

function project() {
  users=(heroku dmathieu)

  if [ ${1[(ws:/:)1]} != ${1[(ws:/:)2]} ]; then
    stickyUser=${1[(ws:/:)1]}
    projectName=${1[(ws:/:)2]}
  else
    stickyUser=
    projectName=$1
  fi

  for user in $users; do
    if [[ -z $stickyUser || $stickyUser == $user ]]; then
      dir=$CODEPATH"/src/github.com/"$user"/"$projectName

      if [[ -d $dir ]]; then
        cd $dir
        gclean
        return
      fi
    fi
  done

  for user in $users; do
    if [[ -z $stickyUser || $stickyUser == $user ]]; then
      apiUri="https://api.github.com/repos/"$user"/"$projectName
      gitUri="https://github.com/"$user"/"$projectName".git"
      code=`curl -n -o /dev/null --silent --head --write-out '%{http_code}\n' $apiUri`

      if [[ $code == 200 ]]; then
        dir=$CODEPATH"/src/github.com/"$user"/"$projectName
        git clone $gitUri $dir
        cd $dir
        return
      fi
    fi
  done

  echo "Couldn't find any project '$1'. Did you mistype it?"
}


alias p="project"

{'fraction_non_alphanumeric': 0.1876750700280112, 'fraction_numerical': 0.012138188608776844, 'mean_word_length': 2.4178628389154704, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5648231', 'n_tokens_mistral': 792, 'n_tokens_neox': 747, 'n_words': 184}