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
# Based on framework semantic subtyping: https://www.irif.fr/~gc/papers/icalp-ppdp05.pdf | |
# CDude implements this framework: https://www.cduce.org/ | |
# Why? | |
## 1. aid documentation | |
## 2. ensure correct contracts | |
# Code examples | |
$ integer() -> integer() |
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 | |
$iterator = test_generator(); | |
echo $iterator->current() . "\n"; | |
$iterator->next(); | |
echo $iterator->current() . "\n"; | |
$iterator->next(); |
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 | |
function test_generator() | |
{ | |
yield "a"; | |
yield "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
<?php | |
foreach (range(1, 9, 2) as $number) { | |
echo "$number "; | |
} | |
foreach (xrange(1, 9, 2) as $number) { | |
echo "$number "; | |
} |
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 | |
function xrange($start, $limit, $step = 1) { | |
if ($start <= $limit) { | |
for ($i = $start; $i <= $limit; $i += $step) { | |
yield $i; | |
} | |
} else { | |
for ($i = $start; $i >= $limit; $i += $step) { | |
yield $i; | |
} |
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
use Money; | |
class Product extends Model | |
{ |
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Product extends Model | |
{ | |
protected $fillable => [ | |
'name', |
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 Money | |
{ | |
private $value; | |
private $currency; | |
public function __construct($value, $currency) | |
{ | |
$this->value = $value; |
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 ruby:2.5 | |
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client sudo | |
EXPOSE 3000 | |
RUN useradd -ms /bin/bash eichef | |
RUN usermod -aG sudo eichef | |
RUN echo "eichef ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
USER eichef |
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
set wildmenu | |
set wildmode=full | |
set history=200 | |
q: // open command line history screen |
NewerOlder