Skip to content

Instantly share code, notes, and snippets.

View mrw's full-sized avatar

Matt Weinberg mrw

View GitHub Profile
@mrw
mrw / vapor-deploy.yml
Created March 9, 2020 17:56
Deploy to Laravel Vapor from Github Actions
name: Deploy to Vapor
on:
push:
branches:
- staging
jobs:
vapor-deploy:
@mrw
mrw / stripe_test.php
Last active March 28, 2018 18:13
Stripe PHP test
<?php
/*
File prepared by Matt Weinberg, www.vectormediagroup.com
EXPLANATION:
In 2018, Stripe will be updating their Live/Production environment TLS settings.
Many servers, especially older ones, will not be able to connect to Stripe after the settings are changed.
@mrw
mrw / paypal_cert_test.php
Last active April 9, 2018 22:42
PHP PayPal new certificate test
<?php
/*
File prepared by Matt Weinberg, www.vectormediagroup.com and www.cartthrob.com
EXPLANATION:
In 2018, PayPal will be updating their Live/Production environment.
Many servers, especially older ones, will not be able to connect to PayPal after the settings are changed.
@mrw
mrw / query.sql
Last active September 15, 2015 20:13
CartThrob sales by product within a date range
SELECT
products.entry_id,
products.title,
order_items.price,
SUM(order_items.quantity) AS total_sold,
SUM(order_items.quantity) * order_items.price AS total_price
FROM
exp_cartthrob_order_items AS order_items
INNER JOIN exp_channel_titles AS products
USING(entry_id)
@mrw
mrw / script.php
Last active July 2, 2017 18:15
Enable MFA Delete on S3 Buckets
<?php
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$s3 = new S3Client([
'region' => 'us-east-1',
'version' => 'latest',
@mrw
mrw / query.sql
Created January 28, 2015 21:41
JIRA comments by user
SELECT JA.ID, author, JA.created, summary, pname, CONCAT(P.pkey, "-", JI.issuenum), JA.actionbody
FROM jiraaction JA
JOIN jiraissue JI ON JA.issueid = JI.id
JOIN project P ON JI.project = P.id
JOIN app_user U ON U.user_key = JA.author
WHERE JA.actiontype = 'comment'
AND U.lower_user_name = 'xxx'
ORDER BY created DESC;
@mrw
mrw / gist:ea1c3e7c506fce61dd8f
Last active August 29, 2015 14:11
JIRA users by login time
SELECT
user_id,
user_name,
email_address,
from_unixtime(attribute_value / 1000) AS last_login_time
FROM
cwd_user_attributes
INNER JOIN cwd_user
ON cwd_user_attributes.user_id = cwd_user.ID
WHERE
@mrw
mrw / ExpressionEngine 2 Multi-Database Setup.php
Created November 1, 2010 16:00
Inside config/database.php: Use a switch statement and the active group in EE2 to set database information based on which server you're currently accessing.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Multiple if statements, or a switch statement,
// can handle as many environments as you need
if ($_SERVER['HTTP_HOST'] == "local-site.dev") {
$active_group = 'expressionengine';
} else {
$active_group = 'enginehosting';
}