PHP

PHP: use docstring to mark function deprecated

15 Oct, 2024
PHP
To mark a PHP function as deprecated and provide an alternative in the docstring, use the @deprecated tag. This makes it clear to developers that the function is deprecated and specifies the...
JavaScript

Dialog form fieldsets to show in columns not rows in CKEditor 4

13 Sep, 2024
Instead of stacking elements vertically in rows, we use an hbox layout, which arranges the child elements horizontally (in a single row). hbox is CKEditor's way of arranging elements in a horizontal...
css3 icon

Equal width columns except the last one, using flex in CSS

13 Sep, 2024
CSS
To create CSS flex columns with equal width except for the last one, you can use this combination of flexbox properties.
JavaScript

Append to HTML with JavaScript

13 Sep, 2024
To append content to an HTML element using JavaScript, you can use appendChild() for DOM elements or innerHTML for strings.
JavaScript

JSHint: Expected an identifier and instead saw ']'.(E030)

6 Sep, 2024
The JSHint error "Expected an identifier and instead saw ']'. (E030)" usually occurs when there is a syntax issue in your JavaScript code involving square brackets ([]). The least obvious is that you...
JavaScript

CKEditor 4: Add edit button to context menu

6 Sep, 2024
This code snippet adds a custom "Edit" button to the CKEditor context menu, specifically for a widget with the class "my-widget." It first creates a new menu group called myWidgetGroup and then...
JavaScript

CKEditor 4: Save dialog form data/state

6 Sep, 2024
The example contains a CKEditor 4 widget with a dialog that allows users to edit widget properties. The dialog loads existing widget data into form fields. When the dialog is submitted, the form data...
css3 icon

Flex 100% width in CSS for a row

6 Sep, 2024
CSS
To set a flex container with flex-direction: row and ensure it takes up 100% width, you can do it like in this snippet. With flex-direction: row, the flex items (the children) will be aligned in a...
preact icon

Preact update state on resize event

22 Aug, 2024
You can create a Preact component that rerenders every time the window is resized by using window.addEventListener('resize'). The general approach involves setting up an event listener in a useEffect...
JavaScript

Parse Url in JavaScript

22 Aug, 2024
To parse a URL in JavaScript, you can use the built-in URL object. This provides an easy way to extract and manipulate different parts of a URL.