List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
| """This program is exactly the same as that of | |
| https://gist.github.com/zzzeek/33943060f7a08cf9e82bf8df1f0f75de , | |
| with the exception that the add_and_select_data function is written in | |
| synchronous style. | |
| UPDATED!! now includes refinements by @snaury and @Caselit . SIMPLER | |
| AND FASTER!! |
| # Refer to the Caddy docs for more information: | |
| # https://caddyserver.com/docs/caddyfile | |
| :80 | |
| reverse_proxy 10.100.100.1:80 |
git subtree push --prefix dist origin gh-pages
This will only push the dist folder to the gh-pages branch Now in the github pages settings change it from 'master' to 'gh-pages' branch
| from sqlalchemy.dialects import postgresql | |
| def bulk_upsert(session: Session, | |
| items: Sequence[Mapping[str, Any]]): | |
| session.execute( | |
| postgresql.insert(MyModel.__table__) | |
| .values(items) | |
| .on_conflict_do_update( | |
| index_elements=[MyModel.id], | |
| set_={MyModel.my_field.name: 'new_value'}, |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| # Add in ~/.bashrc or ~/.bash_profile | |
| function parse_git_branch () { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
| } | |
| RED="\[\033[01;31m\]" | |
| YELLOW="\[\033[01;33m\]" | |
| GREEN="\[\033[01;32m\]" | |
| BLUE="\[\033[01;34m\]" | |
| NO_COLOR="\[\033[00m\]" |