Skip to content

Instantly share code, notes, and snippets.

mihow /
Last active March 22, 2023 02:35
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
export $(cat .env | xargs)
spalladino /
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
wojteklu /
Last active March 21, 2023 21:17
Summary of 'Clean code' by Robert C. Martin

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.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

iangreenleaf / gist:b206d09c587e8fc6399e
Last active March 21, 2023 19:53
Rails naming conventions
View gist:b206d09c587e8fc6399e

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

mohanpedala /
Last active March 21, 2023 07:09
set -e, -u, -o, -x pipefail explanation
zmts /
Last active March 21, 2023 03:09
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
Kartones /
Last active March 20, 2023 21:41
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
kevinSuttle /
Last active March 18, 2023 12:34 — forked from lancejpollard/
List of Usable HTML Meta and Link Tags
tadas-s /
Created April 18, 2013 08:58
MySQL database rename script
# Disclaimer - make backups, use at your own risk.
# Based on this comment:
# Views and stored procedures have to be done separately.
MYSQL="mysql -u root -pyour_password "
mobilemind /
Last active March 10, 2023 09:34
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName