Skip to content

Instantly share code, notes, and snippets.

@domwebber
domwebber / Container-clsx.tsx
Last active February 15, 2023 10:21
TypeScript React "as" Typing
// clsx variant of the base Container component
import React, { ReactNode, ElementType, ComponentPropsWithoutRef } from "react";
import clsx, { ClassValue } from "clsx";
export interface ContainerProps<Tag extends ElementType> {
children: ReactNode;
className?: ClassValue;
as?: Tag;
}
@domwebber
domwebber / .env
Created November 17, 2022 19:03
Simple Docker WordPress Install (MariaDB)
DB_USER="exampleuser"
DB_PASSWORD="examplepassword"
DB_NAME="wordpress_site"
@domwebber
domwebber / BinaryTree.php
Last active April 28, 2022 11:20
PHP Business Logic Lexer
<?php
namespace Salesportal\Query\AST;
class BinaryTree extends Node {
protected $left;
protected $right;
public function getLeft(){
return $this->left;
@domwebber
domwebber / linear_regression.class.php
Last active October 18, 2022 02:23
Linear Regression calculation class in PHP
<?php
class linear_regression {
public function __construct( array $dataset ){
$this->dataset = $dataset;
//Start the execution timer
$start = microtime( true );
//Make the calculations