Skip to content

Instantly share code, notes, and snippets.

View lukewatts's full-sized avatar

Luke Watts lukewatts

View GitHub Profile
@lukewatts
lukewatts / 00_create_users_table.sql
Last active February 24, 2024 17:02
Test MySQL SELECT/UPDATE query sequence for isolation issues (e.g. race condition scenarios, concurrent read/write, phantom reads etc)
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`balance` decimal(8,2) NOT NULL DEFAULT '100.00',
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
@lukewatts
lukewatts / install.sh
Last active June 9, 2022 00:16
Nginx & PHP 8.1 FPM - Ubuntu Installation
# ----------------------------------------
# Install Nginx
# ----------------------------------------
## Update and Upgrade packages
sudo apt update
sudo apt upgrade
## Install Nginx
sudo apt install nginx
@lukewatts
lukewatts / ast.php
Last active May 27, 2022 12:20
AST example for Affinity4\Temple - Indented engine language for PHP
<?php
$input = <<<INPUT
use Affinity4\Temple\Temple
html(lang=en_IE)
head
css(path/to/style)
js(path/to/js defer)
body.app.theme__affinity4#app
@lukewatts
lukewatts / laravel-homestead_error-report.txt
Created December 11, 2019 11:57
Composer self-update fails in Laravel/Homestead due to no proxy settings
==> homestead: Checking if box 'laravel/homestead' version '9.1.0' is up to date...
==> homestead: Clearing any previously set forwarded ports...
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
homestead: Adapter 1: nat
homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
homestead: 80 (guest) => 8000 (host) (adapter 1)
homestead: 443 (guest) => 44300 (host) (adapter 1)
homestead: 3306 (guest) => 33060 (host) (adapter 1)
@lukewatts
lukewatts / .babelrc
Created October 17, 2018 07:52
Medium Article - Use JSX with any MV* framework - Code Snippets - 17 - .babelrc
{
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "Reactbone.createElement"
}
]
]
}
@lukewatts
lukewatts / Reactbone.js
Created October 17, 2018 07:50
Medium Article - Use JSX with any MV* framework - Code Snippets - 16 - Reactbone.js
import dom from 'jsx-render';
const Reactbone = {};
Reactbone.createElement = dom;
export class Component
{
view(el)
{
el.appendChild(this.render());
@lukewatts
lukewatts / index.js
Created October 17, 2018 07:46
Medium Article - Use JSX with any MV* framework - Code Snippets - 15 - Test Component with Reactbone
import Reactbone, { Component } from './Reactbone';
class Test extends Component
{
constructor()
{
super();
this.view(document.getElementById('app'));
}
@lukewatts
lukewatts / index.js
Created October 17, 2018 07:36
Medium Article - Use JSX with any MV* framework - Code Snippets - 14 - Test Component with JSX
class Test extends Component
{
constructor()
{
super();
this.view(document.getElementById('app'));
}
render()
{
@lukewatts
lukewatts / index.js
Created October 17, 2018 07:32
Medium Article - Use JSX with any MV* framework - Code Snippets - 13 - Test Component
import dom from 'jsx-render';
class Component
{
view(el)
{
el.appendChild(this.render());
}
render()
@lukewatts
lukewatts / index.js
Created October 17, 2018 07:25
Medium Article - Use JSX with any MV* framework - Code Snippets - 12 - Base Component
import dom from 'jsx-render';
class Component
{
view(el)
{
el.appendChild(this.render());
}
render()