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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
) | |
func main() { | |
port := os.Getenv("PORT") |
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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.4; | |
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol'; | |
contract MyNFT is ERC721URIStorage { | |
constructor() ERC721("MyNFT", "NFT") { | |
} | |
function mint(address to, uint256 tokenId, string memory uri) public { |
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
<?php | |
//home_context.php | |
//to load Class & Interface file when we need them | |
spl_autoload_register(function ($class_name) { | |
include $class_name . '.php'; | |
}); | |
//at home | |
$consumer = new AtHomeConsumer(); |
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
<?php | |
//EggCoffee.php | |
class EggCoffee implements CoffeeInterface | |
{ | |
private $egg; | |
public function __construct(Egg $egg) | |
{ | |
$this->egg = $egg; |
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
<?php | |
//Egg.php | |
class Egg | |
{ | |
public function taste() | |
{ | |
echo 'It tastes eggyyy...!' . PHP_EOL; | |
} | |
} |
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
<?php | |
//coffee_shop_rainy_day_context.php | |
//to load Class & Interface file when we need them | |
spl_autoload_register(function ($class_name) { | |
include $class_name . '.php'; | |
}); | |
//at the coffee shop in a rainy day | |
$egg = new Egg(); |
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
<?php | |
//SweeterCoffee.php | |
class SweeterCoffee implements CoffeeInterface | |
{ | |
private $coffee; | |
public function __construct(CoffeeInterface $coffee) | |
{ | |
$this->coffee = $coffee; |
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
<?php | |
//coffee_shop_another_day_context.php | |
//to load Class & Interface file when we need them | |
spl_autoload_register(function ($class_name) { | |
include $class_name . '.php'; | |
}); | |
//at the coffee shop in another day | |
$milk = new Milk(); |
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
<?php | |
//MilkCoffee.php | |
class MilkCoffee implements CoffeeInterface | |
{ | |
private $milk; | |
public function __construct(Milk $milk) | |
{ | |
$this->milk = $milk; |
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
<?php | |
//Milk.php | |
class Milk | |
{ | |
public function taste() | |
{ | |
echo 'It tastes milkyyy...' . PHP_EOL; | |
} | |
} |
NewerOlder