Today I Learned
A collection of links and concise write-ups on small things I learn day to day across a variety of languages and technologies.
- What do programmers actually do?
- Front end vs Back end | Blonde Dictionary explanation
- What is Git and Github? Source Control —Coding For Beginners
- How to create a repository on github
- Variables, loops for and while, if, functions, list, tuple, sipmle string manipulations etc. (1-13)
- Enumerate, if in
- git rebase --interactive
- git status | git log --decorate --oneline --graph <3
- Import, file, exceptions (14-17)
- Class, self in class, magical methods, own exceptions (18-22)
- More about magical methods
- 'never' git add . | git add -p <3
- git (config, tools)
- 5-sposobow-na-prace-z-gitem
- 10 Sekretnych Komend Gita, O Których Nie Masz Pojęcia
- git (tags, alias)
- Own autocomplete //swap to alias soon
- Python testing
- Virtualenvwrapper - must have with packages
- Unit Testing vs Integration Testing
- Mocking in python
- Still mocking in python
- Asserations test - unittest
- git (merge, branch)
- merge
- cherry-picking for move commit
- no-ff in merge for no fast forward (flat merge)
- git init --bare (create repo for share code)
- git
- pull = fetch + merge (better fetch and manual)
- git diff --cached (diffrence added to staged area)
- git
- git checkout -- file (return file from last commit) or gut checkout commit -- file (we can use *.html - all files .html)
- git reset --hard (reset modify from disc too) without reset only back commit whithout modify files (example: git reset @^)
- git clean (for remove files) -n (test - only show) -i (interactive) -f (force - real delete) -x (delete file from gitignore) - fd(files and folders)
- git stash - 'hidden' commit (git stash list - list) (git stash pop - last stash back to working copy) use only with save and own tekst
- .gitignore (name/ ignore folder name) (we can use pattern like *.txt, [bB]in/ (bin and Bin)
- .git/info/exlude - private .gitignore
- git check-ignore
- git update-index --asume-unchanged file (ignore for tracked files) --no-asume-unchanged for back
- git ls-files -v (list files + status, 'h' for asume-unchanged)
- git ls-files -v | grep "^[[:lower:]]" list only asume-unchanged files
- git config include.path file_dir (include own configuration)
- includeif.statment example: git config --global includeif.gitdir:C:/dev/work .path .gitfile (add .gitfile to global config only to repos in C:/dev/work)
- git
- git rerere - merge helper (memory our chose)
- git revert - revert changes
- git commit --amend - edit last commit
- git rebase - lineary history -i for interactive mode
- filter-branch - tools for rewrite history
- git remote update --prune - update branch (in someone delete branch, this command delete local too)
- git blame / git gui blame - last editor (line)
- git log -S txt -p - find txt in commit (but not in title) -S is pickaxe
- --format=%h | clip - good help to easy copy commit (for pickaxe)
- git bisect - bug catcher
- git
- gitsubmodules
- gitslave
- subtrea (the best? for submodules still better package management)
- Python
- Global, Local and Nonlocal variables
- else with while, for
- Kite
- Python
- Numbers - Fractions
- Set - 'While using discard() if the item does not exist in the set, it remains unchanged. But remove() will raise an error in such condition.'
- Python
- OOP in Python - Inheritance, Encapsulation, Polymorphism
- More about inheritance
- Method Resolution Order (MRO) - 'In the multiple inheritance scenario, any specified attribute is searched first in the current class. If not found, the search continues into parent classes in depth-first, left-right fashion without searching same class twice.'
- More about inheritance
- Operator overloading
- OOP in Python - Inheritance, Encapsulation, Polymorphism
- Remember the three-step guide to making model changes:
- Change your models (in models.py).
- Run python manage.py makemigrations to create migrations for those changes
- Run python manage.py migrate to apply those changes to the database.
- You should always return an HttpResponseRedirect after successfully dealing with POST data. This tip isn’t specific to Django; it’s just good Web development practice
- pip freeze - installed packages
- create requirments.txt with your installed packages like name=version
- pip install -r requirements.txt
- psycopg2 need to migrate db to postgres
- if install error on virtualenv check
- For security, we can split django settings and docker-composer for normal and prod version.
- File .env is good places for system variables (and passwords). Add it to .gitignore.
- When u run docker-compose (containter with few docker-compose.yml) add them in command line, like: docker compose -f docker-compose.yml -f docker-compose.prod.yml
- check them in the same way (prev command with ps on the end)
- See
- "In django our working directory is always the folder that containts manage.py"
- f-strings > format() > % formating
- mkvirtualenv name - COMMAND FOR WRAPPER (WORKON) - PYTHON
ctrl+alt+o - pycharm sort imports