Skip to content

Instantly share code, notes, and snippets.

View Christilut's full-sized avatar

Christiaan Maks Christilut

  • Netherlands
View GitHub Profile
@Christilut
Christilut / Caddyfile
Created January 3, 2024 12:38
Caddy 2 configuration for Sendy
sendy.example.com {
root * /var/www/sendy
encode gzip
file_server
php_fastcgi unix//run/php/php-fpm.sock {
split .php
index index.php
}
try_files {path} {path}.php
@Christilut
Christilut / VCurrencyField.vue
Created June 7, 2018 18:14
Vuetify Currency Field
<template lang="pug">
v-text-field(
ref='field',
:prefix='prefix',
v-model='model',
@focus='onFocus',
@keyup='onKeyUp',
:error-messages='errorMessages',
v-bind='$attrs',
@change='onChange'
@Christilut
Christilut / countries.js
Created August 22, 2019 19:12
shazam country codes
[
{
id: "US",
name: "United States",
listid: "country-chart-US",
cities: [
{
id: "80149",
name: "Aberdeen SD",
countryid: "US",
abbr --add gco "git checkout"
abbr --add gb "git branch"
abbr --add gp "git push"
abbr --add gl "git pull"
abbr --add gaa "git add --all"
abbr --add gc "git commit -m \"\""
abbr --add gf "git fetch"
abbr --add gs "git status"
abbr --add gcm "git checkout master"
abbr --add gss "git stash save -u"
@Christilut
Christilut / backup-mongodb-to-s3.sh
Created June 4, 2020 07:06 — forked from caraboides/backup-mongodb-to-s3.sh
Simple script to backup MongoDB to S3, without waste diskspace for temp files. And a way to restore from the latest snapshot.
#!/bin/sh
set -e
HOST=localhost
DB=test-entd-products
COL=asimproducts
S3PATH="s3://mongodb-backups-test1-entd/$DB/$COL/"
S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz
S3LATEST=$S3PATH"latest".dump.gz
/usr/bin/aws s3 mb $S3PATH
FOLDER_NAME=${PWD##*/}
PS1='\[\033]0;$FOLDER_NAME\007\]' # set window title
@Christilut
Christilut / README.md
Created May 7, 2019 11:44
mongodb local replicaset
async function timeout(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
}
@Christilut
Christilut / download.ts
Created April 10, 2019 21:20
download file from string
export function download (data: any, filename: string) {
const url = window.URL.createObjectURL(new Blob([data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', filename)
document.body.appendChild(link)
link.click()
}
@Christilut
Christilut / hasParentWithMatchingSelector.js
Created January 8, 2019 09:54
Javascript function to check if target is inside parent selector
function hasParentWithMatchingSelector(target, selector) {
return [...document.querySelectorAll(selector)].some(el =>
el !== target && el.contains(target)
)
}