Skip to content

Instantly share code, notes, and snippets.

@BrendonKoz
BrendonKoz / leaflet-darkmode.md
Last active September 25, 2024 19:25
Automatic Dark Mode for Leaflet.js
// Leaflet JS - note the *className* attribute
// [...]

L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    className: 'map-tiles'
}).addTo(map);

// [...]
@BrendonKoz
BrendonKoz / svg_mask.html
Created June 26, 2018 15:10
SVG Masking Example with multi-element mask
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SVG Masking Test</title>
<style>
body {
background-color: #F0F;
@BrendonKoz
BrendonKoz / sticky-footer.css
Created June 15, 2018 03:00
Simplest and most versatile "sticky footer" ever
@BrendonKoz
BrendonKoz / DeleteOldRecycleBinFiles.ps1
Created January 31, 2018 18:08
A PowerShell script for deleting files (at logoff) from the Recycle Bin after X days of sitting in the bin.
# -----------------------------------------------------------------------
#
# Author : Baldwin D.
# Description : Empty Recycle Bin with Retention (Logoff Script)
# Source : http://baldwin-ps.blogspot.be/2013/07/empty-recycle-bin-with-retention-time.html
#
# -----------------------------------------------------------------------
$Global:Collection = @()
@BrendonKoz
BrendonKoz / auto-caption-tools.md
Last active August 14, 2023 13:28
Automatic Captioning Tools
@BrendonKoz
BrendonKoz / word_stemmer.php
Created February 16, 2017 23:19
Splits words into their base word so that matching works more fluidly in text searches.
<?php
/**
* Copyright (c) 2005 Richard Heyes (http://www.phpguru.org/)
*
* All rights reserved.
*
* This script is free software.
*/
/**
@BrendonKoz
BrendonKoz / bk_autoupdate.php
Created December 22, 2015 17:57
"MUST USE" plugin. Place in wp-content/mu-plugins to assure automatic theme & plugin updates are happening.
<?php
/*
Plugin Name: Theme and Plugin Auto-Update
Description: Forces automatic updates of installed plugins and themes. Be sure to have backups running!
Version: 1.0
Author: Brendon Kozlowski
Author URI: http://www.bytekick.com
License: MIT
*/
<?php
/**
* Convert RGB colors array into HSL array
*
* @param array $ RGB colors set
* @return array HSL set
*/
function rgb_to_hsl($color){
list($r, $g, $b) = is_array($color) ? $color : hex_to_rgb($color);
@BrendonKoz
BrendonKoz / PHPExcelHelper.php
Created October 21, 2014 03:23
A helper class to make creating robust, but simple Excel workbooks with PHPExcel even easier.
<?php
// import (and instantiate) the required 3rd party autoload class for all required classes
require_once('./path_to/PHPExcel.php');
// Call a member method that automatically guesses and assigns cell properties (Date, Number, Text, etc.)
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
class ExcelHelper {
@BrendonKoz
BrendonKoz / gist:df1e0fefedd237120872
Created August 4, 2014 20:26
Simple CKEditor custom load (with jQuery)
$(document).ready(function(){
$('textarea').ckeditor({
contentsCss: '/css/ckeditor_custom.css', //external CSS to set body{margin:0;}
uiColor: '#FFFFFF',
scayt_autoStartup: true, //spellcheck auto-enabled
autoGrow_onStartup: true,
enterMode: CKEDITOR.ENTER_BR, //I hate this but our users request it
removePlugins: 'elementspath, resize',
extraPlugins: 'autogrow,confighelper', //confighelper allows HTML5-like placeholder text
extraAllowedContent: 'img[alt,dir,id,lang,longdesc,!src,title]{*}(*)', //needed to allow image pasting without an image button