Skip to content

Instantly share code, notes, and snippets.

View jaygilmore's full-sized avatar
🕳️
🐇

Jay Gilmore jaygilmore

🕳️
🐇
View GitHub Profile
@jaygilmore
jaygilmore / nginx-wordpress.conf
Created October 22, 2024 15:31 — forked from nfsarmento/nginx-wordpress.conf
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@jaygilmore
jaygilmore / SiteSummary
Created October 18, 2024 12:30
Pretty Site Summary dashboard widget - original by W. Shawn Wilkerson - MODX Revolution
<?php
// SiteSummary snippet for Dashboard widget
// W. Shawn Wilkerson
$o = '<table class="classy" style="width:100%;"><thead><tr style="background:#DDE3EA;color:#000;">';
$o .= '<th style="width:50%;padding:8px 0;text-align:center;">Resources</th>';
$o .= '<th style="width:50%;padding:8px 0;text-align:center;">Elements</th>';
$o .= '</tr></thead><tbody><tr><td style="padding:0 1em;">';
$o .= 'Published Resources: ' . $modx->getCount('modResource', array('published' => '1'));
$o .= '<br>Unpublished Resources: ' . $modx->getCount('modResource', array('published' => '0'));
@jaygilmore
jaygilmore / Messages
Created October 18, 2024 12:30
Dashboard Widget to display the number of internal Manager messages the user has - MODX Revoluition
// Dashboard widget to show number of Manager messages
$id = $modx->user->get('id');
$output = 'No messages.';
$total = $modx->getCount('modUserMessage',array(
'recipient' => $id,
));
if($total) {
$output = 'You have ' . $total . ' messages';
$unread = $modx->getCount('modUserMessage',array(
'recipient' => $id,
@jaygilmore
jaygilmore / hex2rgba.php
Created October 18, 2024 12:29
Hex2Rgbp Custom Output Modifier Snippet
<?php
# hex2rgba
# converts hex value from ColorPicker TV to rgba value
# NOTE that the ColorPicker TV must use the default output option
# based on function from http://mekshq.com/how-to-convert-hexadecimal-color-code-to-rgb-or-rgba-using-php/
if (!function_exists('hex2rgba')) {
function hex2rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
@jaygilmore
jaygilmore / bento-segment.js
Last active September 29, 2023 16:51
Bento Segment Function
// Learn more about destination functions API at
// https://segment.com/docs/connections/destinations/destination-functions
/**
* Handle track event
* @param {SegmentTrackEvent} event
* @param {FunctionSettings} settings
*/
async function onTrack(event, settings) {
// Learn more at https://segment.com/docs/connections/spec/track/
@jaygilmore
jaygilmore / Rsync.MD
Created May 9, 2018 19:48
Rsync from source into Cloud from another server

Logged into Cloud and Rsync from another location into Cloud. Note the Port command if needed.

rsync -azvvP -e  [email protected]:/var/www/ /www --filter=". filter.txt"

With the SSH command for the port if needed.

rsync -azvvP -e 'ssh -p 2801' [email protected]:/var/www/ /www --filter=". filter.txt"
@jaygilmore
jaygilmore / recalculateURIs.php
Created October 25, 2017 19:41 — forked from opengeek/recalculateURIs.php
Script to recalculate all unfrozen URI values for MODX Resources in 2.1.x+
<?php
include 'config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
@jaygilmore
jaygilmore / nginxrules.md
Created June 16, 2017 20:36
Nginx Rules
@jaygilmore
jaygilmore / text.class.php
Last active November 14, 2016 20:05 — forked from pepebe/new_gist_file.php
Fix fatal error "Fatal Error: Cannot redeclare class modTemplateVarInputRenderText..."
<?php
/*
Quick fix for this problem until I have the time to look for the cause.
"Fatal Error: Cannot redeclare class modTemplateVarInputRenderText...
...in core/model/modx/processors/element/tv/renders/mgr/input/text.class.php onl line 10"
*/
/**
* @package modx
@jaygilmore
jaygilmore / shortlog.md
Last active September 26, 2019 16:13
A way to get a list of the committers from the last release to the most recent with the number of commits.

Git Contributors List Method

Replace the versions with the previous first and current second after the ....

git shortlog -s -n v2.7.1-pl...v2.7.7-pl