Skip to content

Instantly share code, notes, and snippets.

View heathdutton's full-sized avatar
🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈

Heath Dutton ☕ heathdutton

🕴️
🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈
  • ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  • Tampa Florida
  • https://orcid.org/0009-0005-9397-422X
View GitHub Profile
@heathdutton
heathdutton / mautic-campaign-delays.sql
Last active November 2, 2018 20:50
Show all Mautic campaign delays in one table.
-- All mautic delays merged. Two queries (the first is important).
SET @@group_concat_max_len = 10000000000000;
SELECT *
FROM (
SELECT NULL as campaign_id,
NULL as campaign_name,
NULL as event_id,
NULL as event_name,
NULL as lead_count,
NULL as type,
@heathdutton
heathdutton / campaigns_unpublished_by_category.sql
Last active October 5, 2018 14:39
Find unpublished categories in Mautic that have published campaigns under them. Because these categories are unpublished all campaigns under them will be paused.
SELECT cat.id as category_id, cat.title as category_name, COUNT(camp.id) as campaigns
FROM campaigns camp
LEFT JOIN categories cat
ON camp.category_id = cat.id
WHERE
cat.is_published = 0
AND camp.is_published = 1
GROUP BY cat.id;
@heathdutton
heathdutton / cf_settings_set.sh
Created September 28, 2018 19:55
Script I use to set typical Cloudflare settings.
#! /bin/bash
cf_user=xxxxxxxxx
cf_token=xxxxxxxxx
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
if [ -z $1 ]
@heathdutton
heathdutton / permissions.sh
Last active January 26, 2019 00:13 — forked from rickhernandezio/permissions.sh
Permissions for Mautic
cd /home/clientsiwanta/public_html/mautic/
find . -type d -exec sudo chmod 755 {} \;
find . -type f -exec sudo chmod 644 {} \;
sudo chmod -R g+w app/cache/
sudo chmod -R g+w app/logs/
sudo chmod -R g+w app/config/
sudo chmod -R g+w media/files/
sudo chmod -R g+w media/images/
sudo chmod -R g+w translations/
sudo chown -R www-data:www-data .
@heathdutton
heathdutton / 92.chart-label-sum.js
Last active December 21, 2020 02:13
Add sums to all charts in Mautic.
// Add sums to all chart labels in Mautic.
Mautic.chartLabelSum = function () {
if (
typeof Mautic.chartObjects !== 'undefined'
&& Mautic.chartObjects.length
) {
var total, numeric, updated, totalStr;
mQuery.each(Mautic.chartObjects, function (i, chart) {
updated = false;
if (
@heathdutton
heathdutton / mautic-custom-fields-alphabetize.sql
Created August 31, 2018 14:02
Put all Mautic Custom fields into alphabetical order by label.
UPDATE lead_fields AS f
CROSS JOIN (
SELECT @cnt := 0
) AS dummy
JOIN (
SELECT (@cnt := @cnt + 1) AS cnt, id
FROM lead_fields
CROSS JOIN (SELECT @cnt := 0) AS dummy
ORDER BY label ASC
) AS c
<?php
$rows = [
'row1' => [
'key' => 'value',
'key2' => 'value2',
'key3' => 'value3',
],
'row2' => [
@heathdutton
heathdutton / 6247.diff
Created July 10, 2018 20:31
6247 As to not conflict with staging and other patches.
diff --git a/app/bundles/CampaignBundle/Controller/CampaignController.php b/app/bundles/CampaignBundle/Controller/CampaignController.php
index 0e854506e8..38c152e180 100644
--- a/app/bundles/CampaignBundle/Controller/CampaignController.php
+++ b/app/bundles/CampaignBundle/Controller/CampaignController.php
@@ -179,7 +179,7 @@ protected function afterEntityClone($campaign, $oldCampaign)
$objectId = $oldCampaign->getId();
// Get the events that need to be duplicated as well
- $events = $oldCampaign->getEvents()->toArray();
@heathdutton
heathdutton / 5970.diff
Created July 10, 2018 17:01
5970 to avoid conflicts with others
diff --git a/app/bundles/CampaignBundle/Entity/CampaignRepository.php b/app/bundles/CampaignBundle/Entity/CampaignRepository.php
index 589253a618..5442ca10d5 100644
--- a/app/bundles/CampaignBundle/Entity/CampaignRepository.php
+++ b/app/bundles/CampaignBundle/Entity/CampaignRepository.php
@@ -22,6 +22,7 @@
class CampaignRepository extends CommonRepository
{
use ContactLimiterTrait;
+ use SlaveConnectionTrait;
@heathdutton
heathdutton / 6247.diff
Created June 27, 2018 14:27
Patch #6247 to not conflict with #6021 and #6187
diff --git a/app/bundles/CampaignBundle/Controller/CampaignController.php b/app/bundles/CampaignBundle/Controller/CampaignController.php
index 0e854506e8..38c152e180 100644
--- a/app/bundles/CampaignBundle/Controller/CampaignController.php
+++ b/app/bundles/CampaignBundle/Controller/CampaignController.php
@@ -179,7 +179,7 @@ protected function afterEntityClone($campaign, $oldCampaign)
$objectId = $oldCampaign->getId();
// Get the events that need to be duplicated as well
- $events = $oldCampaign->getEvents()->toArray();
+ $events = $oldCampaign->getPublishedEvents()->toArray();