Chemaclass on allow-underscores-in-decimal-numbers
update test-numbers-with-unders… (compare)
Chemaclass on allow-underscores-in-decimal-numbers
Update changelog (compare)
Chemaclass on allow-underscores-in-decimal-numbers
Allow decimal number with under… Refactor AtomParser applying ex… (compare)
Chemaclass on numbers-with-underscore
Chemaclass on master
Create failing test-numbers-wit… Update tests/phel/test/core/mat… Merge pull request #562 from ph… (compare)
Chemaclass on numbers-with-underscore
Update tests/phel/test/core/mat… (compare)
[33;34mPhel\Compiler\Domain\Evaluator\Exceptions\CompiledCodeIsMalformedException: [:div {:class "black-group"} [:h2 {:class "black-group-title"} "Expertise"] [[:div {:class "unit pb-4"} [:div {:class "unit-title"} "Laravel" [:br] [:span {:class "unit-subtitle"} " " "The best batteries-included PHP framework"]] [:div {:class "unit-intro"} "Still running my first Laravel 3 application in production environment."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "PHP" [:br] [:span {:class "unit-subtitle"} " " "It gets the job done"]] [:div {:class "unit-intro"} "My main programming language."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "JavaScript" [:br] [:span {:class "unit-subtitle"} " " "It is like wine"]] [:div {:class "unit-intro"} "The language gets better with years."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "React.js" [:br] [:span {:class "unit-subtitle"} " " "Simple top-down logic to follow"]] [:div {:class "unit-intro"} "My preferred JavaScript UI library."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "React-native" [:br] [:span {:class "unit-subtitle"} " " "Native mobile app development"]] [:div {:class "unit-intro"} "Web developers building native mobile apps with web technologies."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Vue.js" [:br] [:span {:class "unit-subtitle"} " " "Alternative to React.js"]] [:div {:class "unit-intro"} "If you know React.js you know Vue.js."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "TypeScript" [:br] [:span {:class "unit-subtitle"} " " "TypeScript is JavaScript with syntax for types"]] [:div {:class "unit-intro"} "Whenever possible I try to use typescript and not use the any type."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Phel" [:br] [:span {:class "unit-subtitle"} " " "Lisp inspired functional programming language that compiles to PHP"]] [:div {:class "unit-intro"} "This website is built with Phel."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "F#" [:br] [:span {:class "unit-subtitle"} " " "Strongly-typed, functional-first programming language"]] [:div {:class "unit-intro"} "This website javascript is written with F#/Fable."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Go" [:br] [:span {:class "unit-subtitle"} " " "Small, simple, easy, powerful"]] [:div {:class "unit-intro"} "I like this language a lot, but have not used it very much."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Elixir" [:br] [:span {:class "unit-subtitle"} " " "Dynamic, functional language for building scalable and maintainable applications"]] [:div {:class "unit-intro"} "Still reading the documentation and learning."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Next.js" [:br] [:span {:class "unit-subtitle"} " " "The React Framework for Production"]] [:div {:class "unit-intro"} "SSR, SSG, ... A React.js framework with batteries included."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "NestJS" [:br] [:span {:class "unit-subtitle"} " " "Progressive Node.js framework for building server-side applications"]] [:div {:class "unit-intro"} "Backend framework but for Node.js. It supports TypeScript and JavaScript."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Nx" [:br] [:span {:class "unit-subtitle"} " " "Smart, Fast and Extensible Build System"]] [:div {:class "unit-intro"} "Used for building monorepos and other stuff."] nil]]] is not a valid element name.
In my index.php I have to manually switch from two modes. One for production and development and one for development.
public/index.php
<?php
declare(strict_types=1);
$projectRootDir = __DIR__ . '/../';
// Compiles Phel code to PHP on each request and then runs it (Slow).
// require $projectRootDir . 'vendor/autoload.php';
// Phel\Phel::run($projectRootDir, 'app\\boot');
// Runs previously compiled PHP code (Fast).
require_once $projectRootDir . "vendor/autoload.php";
require_once $projectRootDir . "dist/app/boot.php";
How could I tell the application to run in specific mode?
All done. Here is the contact form which is now 100% phel and the website is now on 0.7.0 version. If you disable form validation (add novalidate to form) you can see the server side validation and validation error display in action.
I have solved the issue when using compiled and non-compiled phel code:
composer.json
"scripts": {
"dev:slow": "PHEL_MODE=slow php -S localhost:8000 -t public/",
"dev:fast": "composer compile && PHEL_MODE=fast php -S localhost:8000 -t public/",
"compile": "vendor/bin/phel compile",
}
public/index.php
<?php
declare(strict_types=1);
$phelMode = getenv('PHEL_MODE');
file_put_contents("php://stdout", "\nPhel mode: $phelMode\n");
$projectRootDir = __DIR__ . '/../';
if ($phelMode === 'slow') {
// Compiles Phel code to PHP on each request and then runs it (Slow).
require $projectRootDir . 'vendor/autoload.php';
Phel\Phel::run($projectRootDir, 'app\\boot');
return;
}
// Runs previously compiled PHP code (Fast).
require_once $projectRootDir . "vendor/autoload.php";
require_once $projectRootDir . "dist/app/boot.php";
works great for now.
I did some improvements on the phel snake game. https://github.com/Chemaclass/phel-snake#how-to-play The main change is using the compiled phel code instead of compiling it all the time. Aka: compile once, and play as much as you want.
I added some composer scripts to simplify it even more:
./tools/composer compile
./tools/composer play
./tools/composer start
After the game is compiled, you don't have to compile it again, so using directly the play command will give you a better user experience; the game will load way faster 🚀
# https://github.com/Chemaclass/phel-snake/blob/master/play.php
require_once __DIR__ . "/vendor/autoload.php";
$compiledFile = __DIR__ . "/out/phel_snake/game.php";
if (!file_exists($compiledFile)) {
exit('You have to compile the game first. Try with: `composer compile`');
}
$GLOBALS['argv'][] = 'play';
require_once $compiledFile;