Skip to content

Instantly share code, notes, and snippets.

@phptuts
phptuts / index.php
Created February 15, 2019 05:00
PHP Adapter Pattern
<?php
class AuthSystem {
/**
* @var EmailLoginInterface
*/
private $login;
public function __construct(EmailLoginInterface $login)
@phptuts
phptuts / index.php
Created February 15, 2019 05:04
PHP Decorator Pattern
<?php
interface FilterNumber {
/**
* @return @array
*/
public function filter();
}
@phptuts
phptuts / index.php
Created February 17, 2019 02:03
Template Design Pattern
<?php
abstract class Gratitude {
protected $reporter;
protected $date;
@phptuts
phptuts / index.php
Created February 17, 2019 02:22
Strategy Design Patter
<?php
interface Message {
public function send($event);
}
class Mail implements Message {
public function send($event)
@phptuts
phptuts / index.php
Created February 17, 2019 23:38
Chain of Responsibility Pattern
<?php
abstract class RoleChecker {
/**
* @var RoleChecker
*/
protected $nextCheck;
abstract public function check(UserRole $userRole);
@phptuts
phptuts / index.php
Created February 18, 2019 03:43
Observer Pattern
<?php
interface Subject {
public function attach(Observable $observable);
public function detach(Observable $observable);
public function next($value);
}
@phptuts
phptuts / drupal-installation.md
Last active March 15, 2020 02:49
Installing Drupal With land
lando poweroff
rm -rf yoursitename && mkdir -p yoursitename && cd yoursitename
lando init --source remote --remote-url https://www.drupal.org/download-latest/tar.gz --remote-options="--strip-components 1" --recipe drupal8 --webroot . --name yoursitename
lando start

Data Information

database name: yoursitename

@phptuts
phptuts / funky_circles.js
Last active March 24, 2021 07:00
Funky Circles is a way of drawing crazy circles on top of a selfy
// Copy this into the p5.js editor
// https://editor.p5js.org/
let capture;
let circles = [];
let timeToChangeSeconds = 0.2;
let changeColorTime;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="https://glitch.com/favicon.ico" />
<title>Change CSS with JS Picture Changer</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
<!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.0" />
<title>Dynamic Javascript Webpage?</title>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic"