Skip to content

Instantly share code, notes, and snippets.

@justerror
justerror / install nano.sh
Created March 11, 2022 15:39 — forked from BlakeGardner/install nano.sh
Syntax highlighting in nano on Mac OS
# install Homebrew if you don't already have it: http://mxcl.github.io/homebrew/
# install nano from homebrew
brew install nano
# update your nanorc file
echo 'include "/opt/homebrew/Cellar/nano/NANO_VERSION_NUMBER/share/nano/*.nanorc"'>> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
@justerror
justerror / config
Last active March 10, 2022 08:41
SSH config optimised for macOS
ServerAliveInterval 120
TCPKeepAlive no
Compression yes
UseKeychain yes
AddKeysToAgent yes
Host example.com
User dev
HostName 127.0.0.1
Port 2222
@justerror
justerror / .eslintrc.json
Last active November 11, 2021 07:55
Configuration file for ESLint with Angular
{
"root": true,
"env": {
"es6": true
},
"ignorePatterns": ["dist"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
{
"*.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"
// 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
@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
@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 / 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 / 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.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;
}