Skip to content

Instantly share code, notes, and snippets.

@am-on
am-on / text.md
Created January 25, 2024 12:06
Disable body scroll on modal open
  1. Add class only present when modal is opened like <div class="modal-opened">
  2. Prevent scrolling when modal is opened with CSS:
    html body:has(.modal-opened) {
      overflow: hidden;
    }
  3. On modal open the scrollbar will disappear and cause a small layout shift. The easiest way to avoid this is using scrollbar-gutter. With this the page always reserves spacing for scrollbar even if the page doesn't need it.

html {

@am-on
am-on / main.py
Created November 17, 2021 14:36
Normalize gmail email
def normalize_gmail(email: str) -> str:
"""Normalize Gmail address.
foo@gmail.com
f.oo@gmail.com
fo.o+bar@gmail.com
All above addresses belongs to the same gmail account.
Convert all above cases to address with no `.` and `+` : foo@gmail.com
"""
# before
[~] locale
LANG=en_US.utf8
LC_CTYPE=en_US.utf8
LC_NUMERIC=sl_SI.UTF-8
LC_TIME=sl_SI.UTF-8
LC_COLLATE="en_US.utf8"
LC_MONETARY=sl_SI.UTF-8
LC_MESSAGES="en_US.utf8"
LC_PAPER=sl_SI.UTF-8
@am-on
am-on / gist:2380ba3861dacb61379e57bfc8163005
Created September 27, 2017 16:40
Seznam poštnih številk v Sloveniji
1000 Ljubljana
1001 Ljubljana – P.P.
1210 Ljubljana – Šentvid
1211 Ljubljana – Šmartno
1215 Medvode
1216 Smlednik
1217 Vodice
1218 Komenda
1219 Laze v Tuhinju
1221 Motnik
@am-on
am-on / cloudSettings
Last active October 8, 2017 18:06
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-10-08T18:06:57.136Z","extensionVersion":"v2.8.3"}