From bc3f5659576aa0d2803a4cd933079b1393537be5 Mon Sep 17 00:00:00 2001 From: neodarz Date: Thu, 14 Feb 2019 12:46:55 +0100 Subject: Update some tips --- cheat/.cheat/django | 12 ++++++++++++ cheat/.cheat/git | 4 ++++ cheat/.cheat/python | 25 +++++++++++++++++++++++++ cheat/.cheat/tips | 15 +++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/cheat/.cheat/django b/cheat/.cheat/django index 5d25f15..ebb5817 100644 --- a/cheat/.cheat/django +++ b/cheat/.cheat/django @@ -17,3 +17,15 @@ python manage.py runserver 127.0.0.1:8000 # tinymce for django https://github.com/romanvm/django-tinymce4-lite + +# For create a .po file for translation +# first create a locale folder in module folder or edit LOCALE_PATH in conf file + +# run command for generate the file +django-admin makemessages -l fr + +# update the file if there are new translation +django-admin makemessages -l fr + +# compil translations files +django-admin compilemessages diff --git a/cheat/.cheat/git b/cheat/.cheat/git index 8903fa2..9fad2c3 100644 --- a/cheat/.cheat/git +++ b/cheat/.cheat/git @@ -159,3 +159,7 @@ git push origin master:dreamer_theme # Create bare repo shared git init --bare --shared=group + +# This is maybe because type mistake ! +error: src refspec masster does not match any. +error: failed to push some refs to 'ssh://bcorentin@192.168.1.45:8766/volume1/GIT/django-omrii.git' diff --git a/cheat/.cheat/python b/cheat/.cheat/python index e4f5d36..4428b48 100644 --- a/cheat/.cheat/python +++ b/cheat/.cheat/python @@ -17,3 +17,28 @@ python -mjson.tool # Generate requirements.txt pipreqs /path/to/project + +# Tips +# Ressources available in : cheat python_ressources + +Input: décoder avec `decode()`. +Output: encoder avec `encode('utf-8')` + +lors de l'ouverture d'un fichier: +``` +from codecs import open + +# open() de codec à exactement la même API, y compris avec "with" +f = open('fichier', encoding='encoding') +``` + +# Types + +bytes == bytearray + +# non mutable (non modifiable) +bytes +tuple + +# mutable (modifiable) +bytearray diff --git a/cheat/.cheat/tips b/cheat/.cheat/tips index a378d4c..e648853 100644 --- a/cheat/.cheat/tips +++ b/cheat/.cheat/tips @@ -34,6 +34,21 @@ DRY - Don't Repeat Yourself # Tips 12 Make It Easy to Reuse +# Tips 13 +Eliminate Effects Between Unrelateed Things + +# Tips +There Are No Final Decisions + +# Tips 15 +User Trace Bullets to Find the Target + +# Tips 16 +Prototype to Learn + +# Tips 17 +Program Close to the Problem Domain + ### --- Other tips # WISDOM acrostic - understanging an audience -- cgit v1.2.1