Skip to content

Instantly share code, notes, and snippets.

View marcorieser's full-sized avatar

Marco Rieser marcorieser

  • Bronschhofen, Switzerland
  • 02:51 (UTC +02:00)
View GitHub Profile
@marcorieser
marcorieser / Format Antlers, Blade, Vue, Tailwind and PHP with Prettier in PhpStorm.md
Last active January 3, 2024 19:13
Format Antlers, Blade, Vue, Tailwind and PHP with Prettier in PhpStorm

Install dependencies

Run npm install -D prettier prettier-plugin-antlers prettier-plugin-blade prettier-plugin-tailwindcss @prettier/plugin-php in your terminal

Configure prettier

Create a .prettierrc file with the following content

{
  "singleQuote": true,
  "trailingComma": "all",
  "printWidth": 140,

How to setup PHPStorm for Statamic Antlers

  • In the settings under Editor > File Types add the pattern *.antlers.html to Twig.
  • Adjust the syntax under PHP > Twig as shown in the screenshots.

VIM Cheat Sheet

Commands

  • i Start insert mode at current position
  • I Start insert mode beginning of line
  • a Start insert mode after current position (append)
  • A Start insert mode at end of line (append)
  • d Delete
  • dd Delete line
<?php
$current_year = date("Y");
echo '<ul>';
for ($month = 1; $month <= 12; $month++) {
echo '<li>';
echo date("d.M.Y", strtotime("first monday of $current_year-$month") - 1);
echo '</li>';
}
echo '</ul>';
@marcorieser
marcorieser / valet-80-nginx.conf
Last active February 13, 2019 08:23
Laravel Valet project nginx.conf which serves remote upload files if they do not exist localy.
server {
listen 80;
server_name project.test www.project.test *.project.test;
root /;
charset utf-8;
client_max_body_size 128M;
location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
@marcorieser
marcorieser / valet-443-nginx.conf
Last active February 13, 2019 08:24
Laravel Valet project nginx.conf which serves remote upload files if they do not exist localy.
server {
listen 80;
server_name project.test www.project.test *.project.test;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;