Skip to content

Instantly share code, notes, and snippets.

@graceman9
graceman9 / Product.php
Created April 30, 2024 18:58
DDD VO basic example
<?php
class Product
{
public function __construct(
private string $name,
private float $price,
private string $color,
) {
}
version: '3.7'
services:
php-fpm:
build: docker
container_name: 'php'
ports:
- '9001:9001'
volumes:
@graceman9
graceman9 / AtomDateTimeType.php
Created November 23, 2023 05:22
Doctrine atom date type
<?php
namespace App\Doctrine\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
class AtomDateTimeType extends Type
{
@graceman9
graceman9 / adminer-plugin-json-pretty-print.php
Created November 9, 2022 19:58
Adminer plugin Jason pretty print based on json-column.php official plugin
<?php
/** Display JSON values as table in edit
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @author Martin Zeman (Zemistr), http://www.zemistr.eu/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerJsonColumn {
<?php
/**
* @file
*
* Very simple logger, log to console.log().
*/
namespace App;
@graceman9
graceman9 / .lando.yml
Last active January 14, 2020 23:12
Lando - mysql with phpmyadmin
name: simple-mysql-with-phpmyadmin
services:
database:
type: mysql
portforward: true
pma:
type: phpmyadmin
hosts:
- database
tooling:

Keybase proof

I hereby claim:

  • I am graceman9 on github.
  • I am gm9 (https://keybase.io/gm9) on keybase.
  • I have a public key ASDdlUqgJ03sh8MIyv2jD2PnjqQ6eCtXu-qJo7pwaWLTpAo

To claim this, I am signing this object:

@graceman9
graceman9 / template.php
Last active August 29, 2015 14:05
Drupal 7: How to completely theme form (or webform)
<?php
require_once 'template.theme_webform.inc';
/**
* Implements hook_preprocess_HOOK(), form.
*/
function web_preprocess_webform_form(&$variables) {
if ($variables['form']['#form_id'] == 'webform_client_form_72') {
$form = &$variables['form'];
@graceman9
graceman9 / gist:f934ad43139b9fe87e5d
Last active August 29, 2015 14:05
openserver, xdebug, xcallgraph
openserver, xdebug, xcallgraph
xdebug.profiler_enabled=1
@graceman9
graceman9 / gist:97b0d49b2dc88f04f138
Last active August 29, 2015 14:05
Drupal 7 create node programmatically
<?php
/**
* Drupal 7 create node programmatically.
*
* @see https://www.drupal.org/node/1173136, important! - read comments below post.
*
* also @see http://www.lightrains.com/blog/programmatically-create-node-drupal-7, better explanation.
* also @see http://fooninja.net/2011/04/13/guide-to-programmatic-node-creation-in-drupal-7/
*/