Skip to content

Instantly share code, notes, and snippets.

@pearofducks
pearofducks / Caddyfile
Created September 27, 2023 07:24
git-http-backend with Caddy
git.mydomain.com {
root * /usr/share/my-git-storage
reverse_proxy unix//run/fcgiwrap.socket {
transport fastcgi {
env SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend
env GIT_PROJECT_ROOT /usr/share/my-git-storage
env PATH_INFO {path}
env GIT_HTTP_EXPORT_ALL ""
}
}
html
body
hr
abbr[title]
small
sub
sup
table
::-moz-focus-inner
:-moz-focusring
@pearofducks
pearofducks / Makefile
Last active April 13, 2021 13:44
Basic frontend makefile
# this tells Make to run 'make help' if the user runs 'make'
# without this, Make would use the first target as the default
.DEFAULT_GOAL := help
# here we have a simple way of outputting documentation
# the @-sign tells Make to not output the command before running it
help:
@echo 'Available commands:'
@echo -e 'dev \t\t - \t run the development environment
@echo -e 'prod \t\t - \t build for production
@pearofducks
pearofducks / mq.js
Created July 28, 2019 16:50
Svelte media-query readable stores
const setupMQ = (queryString) => (set) => {
const query = window.matchMedia(queryString)
const callback = (e) => set(e.matches)
query.addListener(callback)
callback(query)
return (query) => query.removeListener(callback)
}
// example use
Partnerweb*
Home*
Providers -> Provider List
Provider List
Provider -> Provider
Provider
Contact Details
Edit Contact Details -> Edit Provider
Product Filter List -> Product Filters
Offer List -> Offer
@pearofducks
pearofducks / pretty-vue.sh
Last active October 3, 2020 22:33
Prettier script for Vue files
#!/bin/bash
cd "$(dirname "$(readlink -f "$0")")"
SEDBIN="gsed"
command -v gsed >/dev/null 2>&1 || { SEDBIN="sed"; }
$SEDBIN --version >/dev/null 2>&1 || { echo >&2 "GNU-sed required but not installed. Maybe run: brew install gnu-sed"; exit 1; }
PROC="./node_modules/prettier/bin/prettier.js"
DIR="src/main/javascript"
@pearofducks
pearofducks / zepto.smoothScroll.js
Last active September 11, 2017 17:08 — forked from benjamincharity/zepto.smoothScroll.js
(Actual) smooth scrolling with Zepto.js - with easing
function easeInOutQuart( t ) {
const t1 = t - 1
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * t1 * t1 * t1 * t1
}
function smoothScroll(el, to, duration) {
var initial = $(window).scrollTop()
var dest = to - initial
var start = null
function step (timestamp) {
if (!start) start = timestamp
@pearofducks
pearofducks / .vimrc
Created August 21, 2017 12:54
vimrc
set nocp
call plug#begin('~/.vim/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-haml', { 'for': 'haml' }
Plug 'tpope/vim-commentary'
Plug 'pearofducks/vim-mkdn', { 'for': 'markdown' }
@pearofducks
pearofducks / index.html
Created May 1, 2017 12:44
quick project goofing around with hljs and vue to make a color scheme
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>schemer</title>
<style>
.circle { height: 10px; width: 10px; border-radius: 10px; margin-left: 5px; }
.color-control { display: flex; align-items: center;}
</style>
</head>
<body>
@pearofducks
pearofducks / setup_clt.sh
Created March 7, 2017 05:52
hands-off macOS command-line-tools install
if [[ $(/usr/bin/xcode-select -p &>/dev/null; /bin/echo $?) == 2 ]]; then
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
touch "$cmd_line_tools_temp_file"
cmd_line_tools=$(softwareupdate -l | awk '/\*\ Command Line Tools/ { $1=$1;print }' | tail -1 | sed 's/^[[ \t]]*//;s/[[ \t]]*$//;s/*//' | cut -c 2-)
softwareupdate -i "$cmd_line_tools" --verbose
if [[ $(/usr/bin/xcode-select -p &>/dev/null; /bin/echo $?) != 2 ]]; then
echo "CLT installed."
if [[ -f "$cmd_line_tools_temp_file" ]]; then
rm "$cmd_line_tools_temp_file"
fi