Skip to content

Instantly share code, notes, and snippets.

@jonpontet
jonpontet / create-wildcard-certificate.sh
Last active January 5, 2024 21:13 — forked from dmadisetti/generate-wildcard-certificate.sh
Self-signed wildcard SSL certificate for local development
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 tld"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate "
echo "for a given top-level domain (TLD) and thus should only be used "
echo "for your local development environment."
@jonpontet
jonpontet / Dockerfile
Created November 5, 2023 06:54
My WordPress Docker stack
# Dockerfile
# Defines an image.
# Rebuild this image: docker build -t [image name]:latest .
FROM php:8.2-apache
# Install packages.
RUN apt-get update && apt-get install -y \
vim \
unzip \
@jonpontet
jonpontet / new composer project.sh
Created October 4, 2023 15:06
How to create a new composer project
composer create-project [package][:version] . --no-interaction
@jonpontet
jonpontet / .htaccess
Last active October 31, 2023 17:45
Force HTTPS with a 301 redirect on any page with mod_rewrite in htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@jonpontet
jonpontet / docker-compose.yml
Last active January 16, 2022 20:10
Docker Compose file for PrestaShop with MySQL
version: '3.3'
services:
db:
build:
context: .
network: prestashop-net
container_name: db
image: mysql:5.7
ports:
@jonpontet
jonpontet / prestashop_back_office_css.php
Created December 16, 2021 14:54
How to include custom CSS in the Back Office of PrestaShop
<?php
public function install()
{
if ($this->registerHook('actionAdminControllerSetMedia')) {
return true;
}
$this->uninstall();
return false;
@jonpontet
jonpontet / prestashop_module_config_form.php
Created December 16, 2021 14:45
How to add a settings config form to your custom module in PrestaShop
<?php
// Add all these functions to your custom module
/**
* Function to display content for your module in the Back Office
*
* @return string
*/
public function getContent()
{
@jonpontet
jonpontet / prestashop_group_column_for_customers.php
Created December 16, 2021 14:15
How to add a group column to the customers page in the PrestaShop Back Office
<?php
public function install()
{
if ($this->registerHook('actionCustomerGridDefinitionModifier') &&
$this->registerHook('actionCustomerGridQueryBuilderModifier')) {
return true;
}
return false;
}
@jonpontet
jonpontet / prestashop_add_to_logs.php
Created December 16, 2021 13:45
Add a generic logging function to your custom PrestaShop module that will log messages to the Logs page of the Back Office
<?php
/**
* Generic logging function
*
* @param $event
* @param $info
* @param int $level
* @param null $supplementary
* @return bool
*/
@jonpontet
jonpontet / prestashop_head_js.php
Created December 16, 2021 13:32
How to add a custom JS file to the frontend of PrestaShop
<?php
public function install()
{
// Hook registration needs to go in the install function of your module
if ($this->registerHook('displayHeader')) {
return true;
}
return false;
}