Skip to content

Instantly share code, notes, and snippets.

View copdips's full-sized avatar
🤞
stduying

Xiang ZHU copdips

🤞
stduying
View GitHub Profile
@copdips
copdips / upsert.py
Created March 9, 2019 01:10 — forked from bhtucker/upsert.py
A demonstration of Postgres upserts in SQLAlchemy
"""
Upsert gist
Requires at least postgres 9.5 and sqlalchemy 1.1
Initial state:
[]
Initial upsert:
@copdips
copdips / Types.md
Last active October 21, 2018 23:05 — forked from kevinblumenfeld/Types.md

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
diff --git a/gitprompt.sh b/gitprompt.sh
index 978cae7..0f33e0e 100755
--- a/gitprompt.sh
+++ b/gitprompt.sh
@@ -649,7 +649,11 @@ function gp_add_virtualenv_to_prompt {
local ACCUMULATED_VENV_PROMPT=""
local VENV=""
if [[ -n "${VIRTUAL_ENV-}" && -z "${VIRTUAL_ENV_DISABLE_PROMPT+x}" ]]; then
- VENV=$(basename "${VIRTUAL_ENV}")
+ if [[ $VIRTUAL_ENV == "$(pwd)/.venv" ]]; then