Skip to content

Instantly share code, notes, and snippets.

View chrisdempsey's full-sized avatar

Chris Dempsey chrisdempsey

View GitHub Profile
@chrisdempsey
chrisdempsey / _default-variables.scss
Created April 19, 2024 12:23 — forked from devkinetic/_default-variables.scss
Backport Bootstrap 4 spacing classes to Bootstrap 3 SASS/SCSS
//== Spacing
//
$grid-breakpoints: (
xs: 0,
sm: $screen-sm-min,
md: $screen-md-min,
lg: $screen-lg-min
);
$spacer-x-0: 0rem;
$spacer-y-0: 0rem;
@chrisdempsey
chrisdempsey / rootResource.php
Created December 19, 2023 12:48 — forked from sepiariver/rootResource.php
Get the ID of the "Root Resource", aka "Ultimate Parent", with slightly different feature set.
<?php
/*
* @author @sepiariver
*
* GPL license, no warranties, no liability, etc.
*
* USAGE EXAMPLE:
* [[rootResource? &toPlaceholder=`root_resource`]]
* //followed by something like
@chrisdempsey
chrisdempsey / getTVText.php
Created June 23, 2023 12:53 — forked from goldsky/getTVText.php
Dynamically Render MODX's Template Variable on front-end to get Text and Value
<?php
/**
* getTVText snippet
*
* Dynamically Render Template Variable on front-end to get not only the value,
* but also its input's "text"
*
* @author goldsky <goldsky@virtudraft.com>
*
@chrisdempsey
chrisdempsey / WireGuard_Setup.txt
Created April 20, 2023 09:39 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@chrisdempsey
chrisdempsey / README.md
Created December 29, 2022 21:17 — forked from gjrdiesel/README.md
Expand Ubuntu 20 Proxmox Disk
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button

# Confirm increase in disk space (1TB in my case)
$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                         8:0    0    1T  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0    1T  0 part
@chrisdempsey
chrisdempsey / proxmox-proxy
Created June 24, 2022 23:46 — forked from basoro/proxmox-proxy
Running Proxmox behind a single IP address
I ran into the battle of running all of my VMs and the host node under a single public IP address. Luckily, the host is just pure Debian, and ships with iptables.
What needs to be done is essentially to run all the VMs on a private internal network. Outbound internet access is done via NAT. Inbound access is via port forwarding.
Network configuration
Here’s how it’s done:
Create a virtual interface that serves as the gateway for your VMs:
@chrisdempsey
chrisdempsey / modx-snippets.php
Created March 9, 2021 09:52 — forked from NatemcM/modx-snippets.php
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@chrisdempsey
chrisdempsey / aspect_ratio.php
Created February 24, 2021 12:41 — forked from wazum/aspect_ratio.php
PHP Calculate aspect ratio from width and height
<?php
function getAspectRatio(int $width, int $height)
{
// search for greatest common divisor
$greatestCommonDivisor = static function($width, $height) use (&$greatestCommonDivisor) {
return ($width % $height) ? $greatestCommonDivisor($height, $width % $height) : $height;
};
$divisor = $greatestCommonDivisor($width, $height);
C (chained with next rule)
CO=cookie (set specified cookie)
E=var:value (set environment variable var to value)
F (forbidden - sends a 403 header to the user)
G (gone - no longer exists)
H=handler (set handler)
L (last - stop processing rules)
Last rule: instructs the server to stop rewriting after the preceding directive is processed.
N (next - continue processing rules)
@chrisdempsey
chrisdempsey / createImg.pthumnb.modx.php
Created January 15, 2021 00:22 — forked from NatemcM/createImg.pthumnb.modx.php
A snippet that creates a <picture></picture> element with webp & jpg sources using pThumb with different media sizes depending on layout for bootstrap
<?php
$img_src = $modx->getOption('src', $scriptProperties);
$img_alt = $modx->getOption('alt', $scriptProperties);
$img_width = $modx->getOption('width', $scriptProperties,640);
$is_lazy = $modx->getOption('lazy', $scriptProperties, false);
$img_class = $modx->getOption('class', $scriptProperties, 'img-fluid');
$colums = $modx->getOption('cols', $scriptProperties, '{"xs":12,"sm":12,"md":8,"lg":6,"xl":6}');
$img_type = $modx->getOption('type', $scriptProperties, 'jpg');
$dataAttr = '';