Skip to content

Instantly share code, notes, and snippets.

View jaygilmore's full-sized avatar
🕳️
🐇

Jay Gilmore jaygilmore

🕳️
🐇
View GitHub Profile
@jaygilmore
jaygilmore / nginxrules.md
Created June 16, 2017 20:36
Nginx Rules
@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 / 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 / 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 / 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 / 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 / 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 / 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;
}