This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from 'three' | |
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' | |
import Stats from 'three/examples/jsm/libs/stats.module' | |
import { GUI } from 'three/examples/jsm/libs/dat.gui.module' | |
const scene = new THREE.Scene() | |
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 100) | |
camera.position.z = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Three.js Tutorials by Sean Bradley : https://sbcode.net/threejs/</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
body { | |
overflow: hidden; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Chain of Responsibility Pattern | |
Chain of responsibility pattern is a behavioural pattern used to achieve loose coupling | |
in software design. | |
In this example, a request from a client is passed to a chain of objects to process them. | |
The objects in the chain will decide how to process them and/or pas them to the next in the chain. | |
The objects can also modify the next in the chain if for example you wanted to run objects in a recursive manner. | |
""" | |
from abc import ABCMeta, abstractstaticmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""The Command Design Pattern in Python | |
The command pattern is a behavioural design pattern, in which an abstraction | |
exists between an object that invokes a command, and the object that performs it. | |
This is part 2 of the Command Design Pattern tutorial, | |
where I create a slider, instead of the switch from part 1. | |
The slider also accepts a variable percentage, rather than an ON/OFF | |
The history also records the variable settingg | |
And I also add UNDO/REDO to the Invoker so that you can go backawards and forwards through time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Prototype design pattern | |
""" | |
from abc import ABCMeta, abstractstaticmethod | |
import copy | |
class IProtoType(metaclass=ABCMeta): | |
"""interface with clone method""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
import datetime | |
class IComponent(metaclass=ABCMeta): | |
@staticmethod | |
@abstractmethod | |
def method(self): | |
"""A method to implement""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
class IGraphic(metaclass=ABCMeta): | |
@staticmethod | |
@abstractmethod | |
def print(): | |
"""print information""" | |
class Ellipse(IGraphic): | |
def print(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SubSystemClassA: | |
@staticmethod | |
def method(): | |
return "A" | |
class SubSystemClassB: | |
@staticmethod | |
def method(): | |
return "B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UndecoratedObject: | |
@staticmethod | |
def get(): | |
return "UndecoratedObject" | |
class Decorate: | |
def __init__(self, undecorated): | |
self.undecorated = undecorated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
class IA(metaclass=ABCMeta): | |
@staticmethod | |
@abstractmethod | |
def method_a(): | |
"""An abstract method A""" | |
NewerOlder