Skip to content

Instantly share code, notes, and snippets.

View mlocati's full-sized avatar

Michele Locati mlocati

View GitHub Profile
@mlocati
mlocati / timezone-constants-creator.php
Last active October 23, 2024 17:13
Convert time zone identifiers to/from PHP from/to Windows
<?php
/*
* License: MIT
* Author: Michele Locati <[email protected]>
*/
declare(strict_types=1);
set_error_handler(
@mlocati
mlocati / attach-release-asset.yml
Last active May 13, 2023 11:22
Attach concrete5/ConcreteCMS package archive to releases
name: Attach release asset
on:
release:
types:
- created
jobs:
attach_release_asset:
name: Attach release asset
@mlocati
mlocati / create-release-asset.sh
Created August 6, 2021 09:57
Attach concrete5/ConcreteCMS
#!/bin/sh
set -o errexit
set -o nounset
printf -- '- cleanup... '
rm -rf ./tmp
mkdir ./tmp
echo 'done.'
@mlocati
mlocati / list-pecl-versions.php
Created December 8, 2020 11:44
List all currently defined versions of PECL packages
<?php
set_error_handler(
static function ($errno, $errstr, $errfile, $errline)
{
$message = trim((string) $errstr);
if ($message === '') {
$message = "Unknown error (code: {$errno})";
}
if ($errfile) {
@mlocati
mlocati / fix-ckeditor-eol.php
Last active November 10, 2020 17:23
Fix CKEditor 4 line endings
#!/usr/bin/env php
<?php
const FIX_EOL = true;
const FIX_BOM = true;
set_error_handler(
static function ($errno, $errmsg, $errfile, $errline)
{
throw new RuntimeException("Error {$errno}: {$errmsg}\nFile: {$errfile}\nLine: {$errline}");
@mlocati
mlocati / concrete5-migrations-checker.php
Created July 3, 2020 12:04
Check concrete5 migration IDs
<?php
declare(strict_types=1);
set_error_handler(
static function ($code, $message, $file, $line): void
{
throw new RuntimeException("{$message}\nFile: {$file}\nLine: {$line}");
},
-1
);
@mlocati
mlocati / Enable-HyperV.ps1
Last active July 30, 2020 16:23
Enable or disable Hyper-V (to switch between VirtualBox and Docker for Windows, for example)
<#
To enable Hyper-V:
Enable-HyperV.ps1 $True
To disable Hyper-V:
Enable-HyperV.ps1 $False
Author: Michele Locati <[email protected]>
License: MIT
Source: https://gist.github.com/mlocati/bb146577785511b44412e2fb57f969a6
#>
@mlocati
mlocati / app.php
Last active August 25, 2022 20:52
Install concrete5 on Android (Termux)
<?php
// Save this file as /application/bootstrap/app.php
if (!function_exists('fnmatch')) {
// Shim for fnmatch
// Code from https://www.php.net/manual/en/function.fnmatch.php#100207
define('FNM_PATHNAME', 1);
define('FNM_NOESCAPE', 2);
define('FNM_PERIOD', 4);
define('FNM_CASEFOLD', 16);
@mlocati
mlocati / check-go-pear.phar.sh
Created January 23, 2019 09:35
Check if a go-pear.phar file is an official one
#!/bin/sh
# This script checks if a go-pear.phar is the same as one of the
# ones released on https://github.com/pear/pearweb_phars
#
# MIT License
# Made by Michele Locati <[email protected]> on 2019-01-23
set -o errexit
set -o nounset
@mlocati
mlocati / output.html
Last active March 15, 2017 15:45
Punic units
<!DOCTYPE html>
<html>
<head>
<title>Punic Units sample</title>
<meta name="charset" value="utf-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
</body>
<table class="table table-striped table-bordered">