Skip to content

Instantly share code, notes, and snippets.

@justerror
justerror / nginx.conf
Last active July 26, 2021 11:27
NGINX configuration for Angular app
server {
listen 443 ssl http2;
server_name example.com www.example.com;
root /var/www/example.com/dist;
index index.html;
location / {
try_files $uri $uri/ @index;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
save-prefix="~"
**/.DS_Store
dist
node_modules
npm-debug.log
README.md
LICENSE
Dockerfile*
docker-compose*
.dockerignore
.gitignore
@justerror
justerror / nginx.conf
Created July 29, 2021 08:48
NGINX configuration for Dockerized Angular Universal app
map $cache $expires {
1 max;
0 -1;
default off;
}
map $uri $cache {
"~*\.[0-9a-f]{8,32}\..*$" 1;
~* 0;
}
@justerror
justerror / Makefile
Last active July 29, 2021 08:58
Tagging Docker images with commit hash
NAME := your-registry.com/username/project-name
TAG := $$(git log -1 --pretty=%h)
IMG := ${NAME}:${TAG}
LATEST := ${NAME}:latest
build:
@docker build . -t ${IMG} --progress=plain
@docker tag ${IMG} ${LATEST}
push:
@justerror
justerror / nginx-tls.conf
Created August 4, 2021 16:40 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@justerror
justerror / .gitattributes
Created August 5, 2021 06:52
Gitattributes for web projects
## GITATTRIBUTES FOR WEB PROJECTS
#
# These settings are for any web project.
#
# Details per file setting:
# text These files should be normalized (i.e. convert CRLF to LF).
# binary These files are binary and should be left untouched.
#
# Note that binary is a macro for -text -diff.
######################################################################
@justerror
justerror / Dockerfile
Created August 9, 2021 10:23
Dockerfile for Angular Universal app
FROM --platform=linux/amd64 node:12-alpine as buildContainer
RUN apk --no-cache add git
WORKDIR /app
COPY . ./
RUN npm ci --quiet --unsafe-perm
RUN npm run build:ssr
FROM --platform=linux/amd64 node:12-alpine
WORKDIR /app
COPY --from=buildContainer /app/package.json /app
// Clamps a block of text to a certain number of lines,
// followed by an ellipsis in Webkit and Blink based browsers
// Reference: http://dropshado.ws/post/1015351370/webkit-line-clamp
@mixin text-clamp($lines: 2, $line-height: false) {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: $lines;
// Fallback for non-Webkit browsers
{
"*.html": "htmlhint --config .htmlhintrc -i index.html",
"*.css": [
"stylelint --fix"
],
"*.scss": [
"stylelint -s=scss --fix"
],
"*.{js,ts}": "eslint --fix",
"*.{js,ts,css,scss,md}": "prettier --write"