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
# removing bash warning in mac | |
export BASH_SILENCE_DEPRECATION_WARNING=1 | |
# show git branch | |
function ps1() { | |
local spacing="" | |
if [ -d .git ]; then | |
branch_name=$(git rev-parse --abbrev-ref HEAD) | |
[ ${#branch_name} -gt 10 ] && dots="..." || dots="" | |
spacing="${branch_name::10}$dots |" |
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
# first start your vpn :) or change your DNS | |
sudo apt update && | |
sudo apt upgrade && | |
sudo apt install curl wget make git nginx python-pip vim unrar && |
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 | |
class Person { | |
public function read(BookInterface $book) | |
{ | |
$book->open(); | |
$book->turnPage(); | |
} | |
} |
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 | |
class eReaderAdapter implements BookInterface { | |
private $reader; | |
public function __construct(eReaderInterface $reader) | |
{ | |
$this->reader = $reader; | |
} | |
public function open() | |
{ |
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 | |
class Kindle implements eReaderInterface { | |
public function turnOn() | |
{ | |
var_dump('turn the Kindle on'); | |
} | |
public function pressNextButton() |
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 | |
interface eReaderInterface { | |
public function turnOn(); | |
public function pressNextButton(); | |
} |
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 | |
class Book implements BookInterface { | |
public function open() | |
{ | |
var_dump('opening the paper book.'); | |
} | |
public function turnPage() | |
{ | |
var_dump('turning the page of the paper book.'); |
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 | |
class CarService | |
{ | |
protected $cost = 20; | |
protected $description = 'Basic inspection'; | |
public function getCost() | |
{ | |
return $this->cost; |
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 | |
interface CarService | |
{ | |
public function getCost(); | |
public function getDescription(); | |
} | |
class BasicInspection implements CarService |
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 | |
interface CarService | |
{ | |
public function getCost(); | |
} | |
class BasicInspection implements CarService | |
{ | |
public function getCost() |
NewerOlder