Skip to content

Instantly share code, notes, and snippets.

@alexxxnf
alexxxnf / Dockerfile
Last active August 1, 2020 22:21
Docker image for nginx with dynamic Brotli module
FROM nginx:1-alpine as builder
# ENV NGINX_VERSION 1.16.0 # defined in the base image
ENV NGX_BROTLI_VERSION 0.1.2
ENV BROTLI_VERSION 1.0.7
RUN set -x \
&& mkdir -p /usr/src \
# dowload and extract source files
&& wget -qO- https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar xzf - -C /usr/src \
@alexxxnf
alexxxnf / advanced-checkbox-control-value-accessor.directive.ts
Created September 18, 2017 20:07
Angular checkbox control accessor returning its value instead of true/false
import {Directive, ElementRef, Renderer2, forwardRef, Input} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
export const CHECKBOX_VALUE_OVERRIDE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => AdvancedCheckboxControlValueAccessor),
multi: true,
};
/**
@alexxxnf
alexxxnf / .gitattributes
Last active September 6, 2022 10:15
How I use Git
# Normalize line endings by default
* text=auto
# Don't normalize executable scripts
*.bat text eol=crlf
*.sh text eol=lf
# Don't try to automatically merge lock files
yarn.lock -diff
package-lock.json -diff
@alexxxnf
alexxxnf / sqla_regex.py
Last active February 18, 2024 15:36 — forked from Xion/sqla_regex.py
Regular expression filters in SQLAlchemy
"""
Module implementing an enhanced string column type for SQLAlchemy
with a support for regular expression operators in Postgres and SQLite.
"""
import re
from sqlalchemy import String as _String, Text as _Text, Unicode as _Unicode, UnicodeText as _UnicodeText, event, exc
from sqlalchemy.engine import Engine
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.expression import BinaryExpression, func, literal