Skip to content

Instantly share code, notes, and snippets.

@bgarrant
bgarrant / ValetSwitchPHP.md
Last active September 30, 2022 08:08
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
@bgarrant
bgarrant / ExpressionEngine Laravel Valet.md
Last active March 7, 2022 00:32
How to setup Laravel Valet for an ExpressionEngine site needing PHP 5.6 or PHP 7.1 Support
@bgarrant
bgarrant / How-to-setup-Statamic-above-document-root-on-cPanel-with-Git.md
Last active December 18, 2022 20:37
How to setup Statamic above document root on cPanel with Git

How to setup Statamic above document root on cPanel with Git

This will install Statamic to your /home/USERNAME/ directory and have the needed public facing files files in your /home/USERNAME/public_html/ folder.

Setup your local Statamic environment to have the folder structure below

If you need help setting up above document root, please visit https://docs.statamic.com/knowledge-base/running-above-webroot.

local
public_html
|-- assets
@bgarrant
bgarrant / How-to-Setup-Cron-Task-to-Git-Commit-Statamic-Changes-Hourly-on-cPanel-Server.md
Last active February 2, 2023 04:20
How to Setup Cron Task to Git Commit Statamic Changes Hourly on cPanel Server

How to Setup Cron Task to Git Commit Statamic Changes Hourly on cPanel Server

  • Login to your cPanel account (http://yourdomain.com/cpanel)
  • Click on Cron Jobs in the Advanced Section
  • If you would like to receive an email notification when a command produces output, please enter your email address under Cron Email at the top of the Cron Job setup page.
  • Under Add New Cron Job, select Once Per hour ( 0 * * * * ) from the Common Settings Drop Menu
  • Under Command: add cd /home/USERNAME/PATH/TO/REPO && git add --all && git commit -m "Automatic Hourly Commit"
  • Click Add New Cron Job button

If you would like do adjust the frequency, select a different option from the Common Settings Drop Menu or adjust the values for Minute, Hour, Day, Month, Weekday.

@bgarrant
bgarrant / Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins).md
Last active July 30, 2019 08:11
Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins)

Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins)

You want to setup a Bootstrap 4 Navbar and use native functions in Craft 3 to manage the navigation menu.

This was built for Bootstrap v4.0 and Craft CMS 3.0.0-RC9

Step 1: Install Craft 3

Go to https://github.com/craftcms/docs/blob/v3/en/installation.md and install Craft 3.

Step 2: Download and Install latest Bootstrap 4 build

@bgarrant
bgarrant / Bootstrap 4 Navbar with Statamic 2.x CMS.md
Last active August 29, 2018 13:48
Bootstrap 4 Navbar with Statamic 2.x CMS

Bootstrap 4 Navbar with Statamic 2.x CMS

<nav id="mainNavigation" class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarContent">
@bgarrant
bgarrant / Automatic-Sitemap-XML-Generator-for-Statamic-CMS-Pages-and-Mounted-Collections.md
Last active July 28, 2020 17:02
Automatic Sitemap XML Generator for Statamic CMS Pages and Mounted Collections

How to automatically generate a Sitemap XML file using Statamic CMS.

This method will work for all Pages and Mounted Collections (just like Pages view in CP).

  1. Create a template called sitemap.html and add it to your theme/layouts/ folder.
  2. Add the following code to the new template
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ nav from="/" include_home="true" include_entries="true" exclude="our-team" }}
@bgarrant
bgarrant / How-to-Setup-Multi-Day-Events-with-a-Daily-Schedule-in-Statamic.md
Last active August 29, 2018 13:29
How to Setup Multi-Day Events with a Daily Schedule in Statamic
@bgarrant
bgarrant / How-to-setup-PHPStorm-for-Statamic-Antlers.md
Last active November 21, 2022 17:56
How to setup PHPStorm for Statamic Antlers

How to setup PHPStorm for Statamic Antlers

If any PHPStorm users want better syntax coloring for Antlers I figured out a better way.

  1. Install Handlebars/Mustache plugin and enable the checkbox for “Open HTML files as Handlebars/Mustache” under Languages & Frameworks > JavaScript > Templates. Not perfect but much, much better!

  2. This makes it even better. Disable Inspection and Syntax for Handlebars by click on Hector icon and changing the Highlighting Level for Handlebars to "None". Now no inspection errors!

  3. Enjoy Statamic Antlers inside .html files in PHPStorm.