Skip to content

Instantly share code, notes, and snippets.

View ppo's full-sized avatar

Pascal Polleunus ppo

View GitHub Profile
@ppo
ppo / copier-help.sh
Created January 31, 2021 18:36
copier --help | beautify 100cols
#!/usr/bin/env bash
echo -e "$(cat <<EOT
\e[1;33mWARNING!\e[0;33m
Use only trusted project templates, as they might execute
code with the same level of access as your user.\e[0m
Copier: Create or update a project from a template.
@ppo
ppo / choices.py
Last active November 26, 2020 10:57
Add some functionalities to `django-model-utils.Choices`.
"""Object to store and manipulate lists of choices.
Requires ``django-model-utils``.
"""
from collections.abc import Iterator
from functools import partialmethod
from django import forms
from django.contrib.postgres.fields import ArrayField
from django.db import models
@ppo
ppo / is-utils.js
Last active April 23, 2020 08:05
💾JS Utils: `isEmpty()`, `isObject()`. // Posted on https://stackoverflow.com/a/60908867/101831
Moved to https://github.com/ppo/gist/tree/master/javascript/is-utils
@ppo
ppo / regex-ecma-262-5_1.txt
Last active September 10, 2024 15:36
Validation Regex ECMA-262 5.1 (date and/or time with optional timezone)
Format: YYYY-MM-DDTHH:mm:ss.sssZ
Date: ^\d{4}(-\d{2}){0,2}$
Time: ^\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?$
Time with optional timezone: ^\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?(Z|[\+|-]\d{2}:\d{2})?$
Date and/or time with optional timezone:
(^\d{4}(-\d{2}){0,2})?((^|T)\d{2}(:\d{2}(:\d{2}(\.\d+)?)?)?(Z|[\+|-]\d{2}:\d{2})?)?$