Skip to content

Instantly share code, notes, and snippets.

@dropletmedia
dropletmedia / debounce.js
Created July 22, 2021 08:22
vanilla js debounce fn
function debounce(func, wait = 20, immediate = true) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
@dropletmedia
dropletmedia / migrate-octobercms.md
Created January 13, 2020 14:50
Migrate octobercms site

Migrating an OctoberCMS site

  1. zip up all files/folders of the cms and download
  2. upload and unzip on the new server
  3. export database as .sql
  4. import database (see note)
  5. edit config/database.php and add new db credentials

Notes (if on local dev env)

@dropletmedia
dropletmedia / batch-image-resize.sh
Created January 6, 2020 17:02
Batch image resize and optimise
#!/bin/bash
# Purpose: batch image resizer
# Author: Phil Picton
# absolute path to image folder
FOLDER="/home/phil/Desktop/pics/"
# max width
WIDTH=1200
@dropletmedia
dropletmedia / docx-to-md.sh
Created January 6, 2020 17:00
Convert docx to markdown
#!/bin/bash
# a script to convert docx to markdown and extract images into subfolder
# requirements: pandoc
#
if [ -z "$1" ]; then
echo "Usage:"
echo ""
echo " docx-to-md.sh [filename-no-extension]"
@dropletmedia
dropletmedia / md-to-docx.sh
Last active January 6, 2020 16:57
Markdown to docx and odt
#!/bin/bash
# A script to convert md to docx AND odt
# requirements: pandoc
#
if [ -z "$1" ]; then
echo "Usage:"
echo ""
echo " md-to-docx.sh [filename-no-extension]"