Skip to content

Instantly share code, notes, and snippets.

View SimonJThompson's full-sized avatar
👨‍💻

Simon Thompson SimonJThompson

👨‍💻
View GitHub Profile
yum remove php56u*
yum install php72u-common.x86_64 php72u-cli.x86_64 php72u-fpm.x86_64 php72u-opcache.x86_64 php72u-mysqlnd.x86_64
yum install php72u-bcmath.x86_64 php72u-intl.x86_64 php72u-pdo.x86_64
yum install php72u-xml.x86_64 php72u-gd.x86_64 php72u-sodium.x86_64 php72u-soap.x86_64 php72u-mbstring.x86_64 php72u-json.x86_64
service nginx restart && service php-fpm restart
@SimonJThompson
SimonJThompson / MariaDB10.repo
Created February 28, 2019 10:46
Playbooks - MariaDB10.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
@SimonJThompson
SimonJThompson / perms.sh
Created August 14, 2018 14:09
Magento 2 File Permission Reset
# Generic file permissions.
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
# relax ./var permissions.
find ./var -type d -exec chmod 777 {} \;
find ./var -type f -exec chmod 777 {} \;
# relax ./generated resets.
find ./generated -type d -exec chmod 777 {} \;
(function(){function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return i(r||t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}return t})()({1:[function(t,e,r){
// Require our cheerio dependency.
const cheerio = t("cheerio");
// Add the fetch listener.
addEventListener('fetch', event => {
event.respondWith(fetchAndModify(event.request))
})
<script type="text/javascript" src="https://unpkg.com/[email protected]/promise.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/fetch.js"></script>
<script type="text/javascript">
(function() {
// Add your settings.
var dcWhitelist = ['YOUR_ORIGIN']
, dcKey = encodeURIComponent('YOUR_KEY');
// Check against the whitelist.
var dcOrigin = document.location.protocol + '//' + document.location.host;
@SimonJThompson
SimonJThompson / wordpress-fix-collations.sql
Created October 28, 2016 07:50
Switch WP collations to utf8_unicode_ci
# wp_posts
CREATE TABLE `wp_posts_temp` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`post_author` bigint(20) unsigned NOT NULL DEFAULT '0',
`post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`post_content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`post_title` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`post_excerpt` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`post_status` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'publish',
@SimonJThompson
SimonJThompson / clear-reviews.sql
Created July 21, 2015 08:17
Magento SQL Snippets
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE review;
TRUNCATE TABLE review_detail;
TRUNCATE TABLE review_store;
TRUNCATE TABLE review_entity_summary;
SET FOREIGN_KEY_CHECKS = 1;
@SimonJThompson
SimonJThompson / gist:bb1cb9eaa0d9f349e408
Created May 25, 2015 00:44
Stop MySQL auto-increment holes
innodb_autoinc_lock_mode=0
@SimonJThompson
SimonJThompson / objecttable.js
Last active August 29, 2015 14:14
JS object arrays to table
function tableFromObjectArray(arr) {
var tStr = "<table>";
tStr+="<thead><tr>";
for(prop in arr[0]) {
tStr+="<td>"+prop+"</td>";
}
tStr+="</tr></thead>";
for(var i=0;i<arr.length;i++) {
tStr+="<tr>";
for(prop in arr[i]) {
@SimonJThompson
SimonJThompson / check-fbapp-ua.php
Last active August 29, 2015 14:13
Test UA to see if it's the iPhone Facebook App
<?php if(strpos($_SERVER['HTTP_USER_AGENT'],'FBAN')){ ?>
Looks like you're in the Facebook app, yo.
<?php } ?>