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 / 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 / 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",
@Christilut
Christilut / README.md
Created May 7, 2019 11:44
mongodb local replicaset
@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)
)
}
@Christilut
Christilut / tooltip.js
Last active January 8, 2019 09:29
Vue component for showing a simple tooltip
Vue.component('tooltip', {
name: 'tooltip',
props: {
disabled: Boolean,
x: {
type: Number,
default: 0
},
y: {
@Christilut
Christilut / transition.scss
Last active January 8, 2019 09:29
Vue component for dynamic height show/hide transitioning
.expand-enter-active,
.expand-leave-active {
transition: height 0.4s ease;
overflow: hidden;
}
.expand-enter,
.expand-leave-to {
height: 0;
}
$g: 20px;
$props: (
(margin, ma),
(margin-top, mt),
(margin-bottom, mb),
(margin-left, ml),
(margin-right, mr),
(padding, pa),
(padding-top, pt),