Skip to content

Instantly share code, notes, and snippets.

View DragonBe's full-sized avatar
:octocat:
The next step…

M van Dam DragonBe

:octocat:
The next step…
View GitHub Profile
@DragonBe
DragonBe / azureConnectionStringToPdo.php
Created May 2, 2021 21:24
Convert an Azure Connection String for MySQL into a PDO resource
<?php
declare(strict_types=1);
/**
* Example usage:
*
* $connString = 'Database=localdb;Data Source=127.0.0.1:12345;User Id=dbuser;Password=$3cR37!';
* $pdo = azureConnectionStringToPdo($connString);
*/
@DragonBe
DragonBe / dragdrop.html
Last active March 15, 2021 15:10
Simple Drag and Drop functionality using jQuery and jQuery UI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Drag and Drop example</title>
<!-- Bootstrap -->
@DragonBe
DragonBe / Product.php
Created March 28, 2014 13:21
Example usage for ArrayAccess interface
<?php
class Product implements ArrayAccess
{
protected $_productId;
protected $_title;
protected $_price;
protected $_arrayAccess;
public function __construct($data = null)
@DragonBe
DragonBe / WooCommerce Plugin Privacy Checker Concept.md
Created May 10, 2020 17:46
Here's a step-by-step process to check if a WooCommerce plugin adopts the privacy functionality provided by the platform by extending WC_Abstract_Privacy.

Plugins checker

This is a small report about plugins I've verified with phpdoc for extending WC_Abstract_Privacy privacy class provided by WooCommerce.

Based on information found in WooCommerce Guidelines for GDPR, Making Woo Extensions GDPR compliant and the whole WC_Abstract_Privacy class API.

Plugins not extending the privacy class

@DragonBe
DragonBe / Vagrantfile-php7.3
Created October 8, 2019 21:44
Quickly set up a Vagrantbox with Debian 8 and PHP 7.3
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.hostname = "jenkins-php7"
config.vm.network "private_network", ip: "192.168.121.4"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "shell", inline: <<-SCRIPT
apt-get update
apt-get upgrade -y
apt-get install -y \
ca-certificates \
@DragonBe
DragonBe / Vagrantfile
Created January 19, 2018 16:26
A quick-and-simple VM with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.host_name = "phpvm"
config.vm.box_check_update = false
config.vm.network "private_network", ip: "192.168.33.67"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
@DragonBe
DragonBe / config-php.sh
Created November 12, 2016 01:03
A quick configure script for building PHP
#!/bin/sh
PHP=$1
if [ $# -lt 1 ]
then
echo "Usage: $0 <php-version>"
echo
echo "php-version: php7 $PHP"
echo
@DragonBe
DragonBe / PHP-Project-Top10-List.md
Last active August 9, 2018 02:49
My personal top 10 list of PHP projects

PHP Project Top10 List

This list is my personal top 10 list of PHP projects that have no financial backup or support which deserves credits. I've also included my motivation as reference.

Software projects

  • Composer: It revolutionised PHP world by allowing people to build awesome components supported by major frameworks and tools
  • PHPUnit: Since it was ported to PHP it added quality and easy maintenance to a lot of projects
  • XDebug: This tool has offered developers a chance to analyse their code step by step to find bugs or solve coding mysteries
  • Slim Framework: A true PHP microframework
  • Phing: The PHP build tool
@DragonBe
DragonBe / gitarchive.sh
Created June 7, 2018 07:47
Creating a GPG signed archive of your GIT source code with SHA 256 checksums in bash
#!/bin/bash
# Getting the current project's directory
pf=$(printf '%q\n' "${PWD##*/}")
# Getting the current configured user's email
gpguser=$(git config user.email)
if [ -z $gpguser ]
then
echo "!!! ERROR: No user for GIT configured !!!"