Skip to content

Instantly share code, notes, and snippets.

/**
* @param {string} locale
* @param {string} type
* @returns {Array<String>}
*/
function getMonthsNames(locale = "en-GB", type = "short") {
const fmt = new Intl.DateTimeFormat(locale, { month: type });
const months = [];
for (let month = 0; month < 12; month++) {
months.push(fmt.format(new Date(Date.UTC(2000, month, 1, 0, 0, 0))));
@dgrammatiko
dgrammatiko / jeditor.php
Created July 18, 2024 12:35
WYSIWYG tinyMCE with FontAwesome
<?php
/**
* @copyright (C) 2021 Dimitrios Grammatikogiannis
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* This endpoint returns ONLY the CSS contents for the template
*/
defined('_JEXEC') || die;
@dgrammatiko
dgrammatiko / instructions.md
Created January 15, 2024 09:56 — forked from benfoxall/instructions.md
apache vhosts
/* https://go.tacodewolff.nl/minify */
enScroll=!1;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{};function a(){const k="G-XXXXXXXXXX",t=()=>Math.floor(Math.random()*1e9)+1,n=()=>Math.floor(Date.now()/1e3),y=()=>(sStor._p||(sStor._p=t()),sStor._p),v=()=>t()+"."+n(),p=()=>(lStor.cid_v4||(lStor.cid_v4=v()),lStor.cid_v4),m=lStor.getItem("cid_v4"),u=()=>m?void 0:enScroll==!0?void 0:"1",l=()=>(sStor.sid||(sStor.sid=n()),sStor.sid),d=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},r="1",h=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +r,sStor.sct=x;else sStor.sct=r;return sStor.sct},e=docLoc.search,f=new URLSearchParams(e),a=["q","s","search","query","keyword"],g=a.some(t=>e.includes("&"+t+"=")||e.includes("?"+t+"=")),i=()=>g==!0?"view_search_results":enScroll==!0?"scroll":"page_view",b=()=>enScroll==!0?"90":void
@dgrammatiko
dgrammatiko / fix.php
Last active February 21, 2022 06:12
Fix broken 4.1 update
<?php
define('JOOMLA_MINIMUM_PHP', '7.2.5');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
die(str_replace(
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/templates/system/incompatible.html')
));
}

Developers please conform to the new image convention

Joomla 4 shipped with native support for lazy loading images and also with a new concept of adapters for storing images. This requires some attention in the code.

Tobias Zulauf was the developer that handled the communication with the Google devs for implementing all the nice recomendation whenever you run a lighthouse. On top of that he was the one that created the plugin that would allow the Web Platform new feature called images lazy loading. On a weird turn of events the project decided not to go with the plugin approach but rather to use the native support for lazy loading as the default behaviour universally for all the images. There were a lot of discussions with people commenting against this approach, mainly because the first itteration was treating every image as a lazy loadable image. This was rectified few month later when the image picker code had to be revisited so it would allow remote storage of images (what is known as Media Ada

@dgrammatiko
dgrammatiko / main.js
Created January 7, 2022 19:30
Get all open Joomla issues
/**
* Needs npm init
* Needs npm install octokit
* Needs npm install dotenv
*/
const fs = require('fs');
const { Octokit } = require("octokit");
require('dotenv').config()
const octokit = new Octokit({

Joomla Child Templates

Joomla 4.1 will support templates with the ability to create child template. Actually the code already exists since 4.0 and this Pull Request. The UI was missing anything meaningful prior to 4.1 so although the new mode technically was supported it wasn't exposed to the end users. The missing UI part will be introduced with Pull Request.

So, what are child templates?

Child templates basically are templates with only one file: templateDetails.xml.

@dgrammatiko
dgrammatiko / my-ender-corexy
Last active July 29, 2024 08:11 — forked from joshschools/moonraker.cfg
printer.cfg
[include kiauh_macros.cfg]
[mcu]
serial: /dev/serial/by-id/usb-Klipper_lpc1769_0460001525813AAF64DC6B5CC12000F5-if00
# serial: /dev/serial/by-id/usb-Klipper_lpc1768_20200015A88C3CAF9ECE705CC32000F5-if00
[pause_resume]
[display_status]
[virtual_sdcard]

Make sure XDEBUG is enabled

Add in php.ini

[xdebug]
  zend_extension="path/to/xdebug.so"
  xdebug.mode=debug
  xdebug.start_with_request = yes
 xdebug.client_port = 9090