Skip to content

Instantly share code, notes, and snippets.

View .zshrc
export GOPATH=$HOME/go
export GO111MODULE=on
export GOPROXY="https://proxy.golang.org"
if [ -d "$HOME/.composer/vendor/bin" ] ; then
PATH="$HOME/.composer/vendor/bin:$PATH"
fi
if [ -d "$GOPATH" ] ; then
PATH="$GOPATH/bin:$PATH"
@dre1080
dre1080 / localhost-tld.md
Last active Apr 18, 2020 — forked from marek-saji/dev-tld.md
Configure local DNS server to serve *.localhost domains
View localhost-tld.md

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq

  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo systemctl restart NetworkManager.

  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.

@dre1080
dre1080 / Dockerfile
Created Oct 23, 2019
Nuxt.js Multi-Stage Dockerfile
View Dockerfile
# Build
FROM node:latest as build-env
ENV NODE_ENV production
WORKDIR /src
COPY . .
RUN yarn install \
View semantic-commit-messages.md

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

View gist:a3699bcb433f4d04d155955206a363e3
Series:
{n.space('.').colon('-').replaceAll(/[!?.]+$/).replaceAll(/&/, 'and').replaceAll(/[`´‘’ʻ']/).replaceAll(/\*/, '-').replaceTrailingBrackets('$1')}.{s00e00}.{t.space('.').colon('-').replaceAll(/[!?.]+$/).replaceAll(/&/, 'and').replaceAll(/[`´‘’ʻ']/).replaceAll(/\*/, '-').replaceTrailingBrackets('$1')}
Movies:
{n.colon(' - ')} ({y})
@dre1080
dre1080 / deploy.sh
Created Oct 29, 2018
Zero Downtime Docker Compose Deploys
View deploy.sh
#!/usr/bin/env bash
CONTAINER_NAME="$1"
PROJECT_NAME="app"
# lets find the first container
FIRST_NUM=`docker ps | awk '{print $NF}' | grep app_$CONTAINER_NAME | awk -F "_" '{print $NF}' | sort | head -1`
NUM_OF_CONTAINERS=1
MAX_NUM_OF_CONTAINERS=2
@dre1080
dre1080 / Contract Killer 3.md
Last active Oct 22, 2018 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@dre1080
dre1080 / parse_dotenv.bash
Created Oct 15, 2018 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@dre1080
dre1080 / _mixins.scss
Last active Oct 10, 2018
Element UI Spacing Utilities
View _mixins.scss
@mixin res($key, $map: $--breakpoints) {
// 循环断点Map,如果存在则返回
@if map-has-key($map, $key) {
@media only screen and #{inspect(map-get($map, $key))} {
@content;
}
} @else {
@warn "Undefeined points: `#{$map}`";
}
}
You can’t perform that action at this time.