Skip to content

Xarvius/TIL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 

Repository files navigation

TIL

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.

Day 1

Day 2

Official python tutorial

Day 3

Day 4

Day 5

Day 6

Day 7

Day 8

Day 9

  • 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)

Day 10

  • git
    • pull = fetch + merge (better fetch and manual)
    • git diff --cached (diffrence added to staged area)

Day 11

  • 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)

Day 12

  • git
    • git reset --hard ORIG_HEAD - return before merge/rebase
    • git fetch --prune --prune-tags
  • VIM

Day 13

  • 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

Day 14

Day 15

Day 16

Day 17

  • 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.'

Day 18

  • 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.'
    • Operator overloading

Day 19

Day 20

Day 21

Day 22

Day 23


Day 25

Day 26

  • 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

Day 27

  • 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

Day 28

ctrl+alt+o - pycharm sort imports

About

Today I Learned

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages