Guards are powerful construct, but they increase complexity:
def pasta_recipe(eggs) when is_list(eggs), do: scramble(eggs)
With pattern matching the function definitions is shorter:
def pasta_recipe([_ | _] = eggs), do: scramble(eggs)
#!/usr/bin/bash | |
sudo apt -y install libsodium-dev libxslt1-dev | |
PHP_CONFIGURE_OPTIONS="--with-pgsql --with-openssl --with-sodium --with-xsl --with-iconv" \ | |
asdf install php 8.3.8 |
packer { | |
required_plugins { | |
amazon = { | |
version = ">= 1.0.0" | |
source = "github.com/hashicorp/amazon" | |
} | |
} | |
} | |
variable "aws_region" { |
<?php | |
// Forked from https://github.com/magento/magento2/issues/19597#issuecomment-671880440 | |
use Magento\Framework\App\Bootstrap; | |
require __DIR__ . '/app/bootstrap.php'; | |
$bootstrap = Bootstrap::create(BP, $_SERVER); | |
$obj = $bootstrap->getObjectManager(); | |
$state = $obj->get(Magento\Framework\App\State::class); | |
$state->setAreaCode('adminhtml'); |
Because Varnish doesn't support SSL, most people choose a setup where Nginx SSL will forward all traffic to Varnish and Varnish will forward will forward the traffic it cannot handle back to nginx. Or worse, bind Varnish on port 80 and direct all traffic into Varnish. This will already degrade performance, because Varnish will purge more because static files are also taking up room in the cache.
Next up, the Nginx configuration of Magento will handle static files.
Generate PHP8.1 data model class with constructor promoted properties named ${DTO_NAME} with fields extracted from this array keys: | |
[ | |
"externalid" => $quoteItem->getItemId(), | |
"name" => $quoteItem->getName(), | |
"price" => $this->coreHelper->priceToCents($quoteItem->getPrice()), | |
"quantity" => $quoteItem->getQty(), | |
"sku" => $quoteItem->getSku(), | |
"description" => $quoteItem->getDescription(), | |
"imageUrl" => $imageUrl, | |
"productUrl" => $product->getProductUrl() |
brew install libpq | |
PHP_CONFIGURE_OPTIONS="--with-pgsql --with-openssl --with-sodium --with-xsl --with-iconv=$(brew --prefix libiconv)" asdf install php 8.1.25 |
Using Symfony 6 and Tailwind, refactor this into modern looking login form: Here place code snippet
<script> | |
const isActive = ref(true) | |
const error = ref(null) | |
const classObject = computed(() => ({ | |
active: isActive.value && !error.value, | |
'text-danger': error.value && error.value.type === 'fatal' | |
})) | |
</script> |