Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Kubler kublermdk

View GitHub Profile
@kublermdk
kublermdk / GoogleCloudFilesystem.php
Created Jan 28, 2022
Update creocoder\flysystem\GoogleCloudFilesystem to support the GoogleStorageAdapter which allows VISIBILITY_NOT_SET
View GoogleCloudFilesystem.php
<?php
/**
* @link https://github.com/creocoder/yii2-flysystem
* @copyright Copyright (c) 2015 Alexander Kochetov
* @license http://opensource.org/licenses/BSD-3-Clause
*
* Updated by Michael Kubler @kublermdk to support VISIBILITY_NOT_SET by using the different Google Storage Adapter
*/
namespace app\adaptors;
@kublermdk
kublermdk / GoogleStorageAdapter.php
Created Jan 28, 2022
Update Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter to support VISIBILITY_NOT_SET
View GoogleStorageAdapter.php
<?php
namespace app\adaptors;
use Google\Cloud\Storage\Acl;
use League\Flysystem\AdapterInterface;
/**
* @package app\adaptors\GoogleStorageAdapter
* Updated by Michael Kubler @kublermdk to support VISIBILITY_NOT_SET
@kublermdk
kublermdk / stripe-mock-php-sdk-client-setup.php
Last active Jan 4, 2022
Setting up the Stripe PHP SDK to use the stripe-mock server
View stripe-mock-php-sdk-client-setup.php
<?php
include_once './vendor/autoload.php';
use Stripe\ApiRequestor;
use Stripe\Stripe;
// ---------------------------------------
// Stripe Mock Setup
// ---------------------------------------
@kublermdk
kublermdk / stripe-mock-install.sh
Created Jan 4, 2022
Stripe Mock Installer for Vagrant VM
View stripe-mock-install.sh
#!/bin/bash
## ============================
## Stripe Mock Install
## ============================
# The Go language is used for the Stripe Mock server
# Can't just run > "sudo apt-get install golang"
# The Ubuntu default is go v1.6 which isn't supported, you get an error about sort.Slice e.g:
# src/github.com/stripe/stripe-mock/server/server.go:478: undefined: sort.Slice
View keybase.md

Keybase proof

I hereby claim:

  • I am kublermdk on github.
  • I am kublermdk (https://keybase.io/kublermdk) on keybase.
  • I have a public key whose fingerprint is A4E7 8586 B2E9 C893 899E A0E6 C1C8 2A76 4A27 EB4F

To claim this, I am signing this object:

@kublermdk
kublermdk / exampleGoogleAutoMLPrediction.php
Created Oct 6, 2020
Example Google AutoML Prediction with a Google Cloud Storage source
View exampleGoogleAutoMLPrediction.php
<?php
// --------------------------------------------------
// Example Google Cloud AutoML Prediction
// --------------------------------------------------
// @author Michael Kubler
// @date 2020-10-07th
// This is a cut down gist of what you need to
// make a Google Cloud AutoML (Auto Machine Learning)
// prediction request, based off an already uploaded
@kublermdk
kublermdk / ExampleGeneralMongoDBAggregations.js
Created May 10, 2020
An example of the MongoDB Aggregation pipelines and commands used for some general filters. View
View ExampleGeneralMongoDBAggregations.js
// -----------------------------------------------------------------
// Applying aggregation pipeline #1 Customer - HAVE
// -----------------------------------------------------------------
db.command({
"aggregate": "app.customer",
"pipeline": [{
"$match": {
"$and": [{
// -- Ensure the customers we are selecting are active and have a Firebase token so we can send them a push notification
"status": "active",
@kublermdk
kublermdk / Example Customer and Customer Transaction.js
Last active May 10, 2020
An example of a Customer and Customer Transaction for the article "Advanced Filtering with MongoDB Aggregation Pipelines"
View Example Customer and Customer Transaction.js
{
"customer": {
"_id": "5eb3d000af2f5c073c089cd2", // ObjectId
"name": "Michael Kubler",
"dateOfBirth": 467683200, // Unix time
"state": "SA",
"gender": "male",
"status": "active",
"createdAt": 1588760101, // Unix time
"updatedAt": 1588760914 // Unix time
@kublermdk
kublermdk / yii2-mongodb-srv-support-test.php
Created Oct 28, 2019
A PHP command line script for checking the REGEX of the mongodb+srv support
View yii2-mongodb-srv-support-test.php
<?php
/**
* @return string database name
*/
function getDefaultDatabaseName($dsn)
{
if (preg_match('/^mongodb(:|\+srv:)\\/\\/.+\\/([^?&]+)/s', $dsn, $matches)) {
// Updated Pattern: /^mongodb(:|\+srv:)\\/\\/.+\\/([^?&]+)/s
// Original Pattern: '/^mongodb:\\/\\/.+\\/([^?&]+)/s'