Skip to content

Instantly share code, notes, and snippets.

View b2z's full-sized avatar
:octocat:
Ready

Dmitrijs Rekuns b2z

:octocat:
Ready
View GitHub Profile
@Septdir
Septdir / README-ru-RU.md
Last active June 26, 2024 10:36
Joomla Install Script

Установочный скрипт для Joomla

Пример установочного скрипта для Joomla

Using Bootstrap in Joomla 4

Joomla 4 introduces a modular approach for interactive components

  • What is a modular approach?
  • The functionality is broken down into individual components, files. There is no one file approach as it was with Bootstrap in Joomla 3. This was done for efficiency and performance gains (send only the code that is needed instead of delivering everything in case some page will need so component).

How to deal with Interactive components

  • Load what you need per case! There are helper functions that will help you achieve this and, it is dead easy just call the function with the appropriate arguments.
@AlekVolsk
AlekVolsk / dominant_color.php
Last active November 7, 2021 21:12
Get Dominant & Сontrast color
<?php
/**
* getDominantColor
* Получение доминантного цвета. Функция требует наличия библиотеки GD.
*
* @param string $fname полный путь к файлу относительно сервера
* @param bool $skipBlackAndWhite пропускать чисто белый и чисто чёрный тона
* @return array
*/
@Septdir
Septdir / joomla-ajax.js
Last active April 5, 2020 17:14
Ajax request for joomla
let request = new XMLHttpRequest(),
requestUrl = '', // Указываем url запроса
formData = new FormData(); // Перадаем <form> или просто добавляем ниже через append что нужно
request.open('POST', requestUrl);
request.send(formData);
request.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
let response = false;
try {
@adriennetacke
adriennetacke / countdown.js
Last active September 1, 2022 04:18
Countdown timer in pure JavaScript
function countdown(endDate) {
let days, hours, minutes, seconds;
endDate = new Date(endDate).getTime();
if (isNaN(endDate)) {
return;
}
setInterval(calculate, 1000);
@fevangelou
fevangelou / my.cnf
Last active May 25, 2024 19:49
Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#

Git Cheat Sheet

Commands

Getting Started

git init

or

@phproberto
phproberto / asset.php
Created May 21, 2014 00:11
Sample Joomla asset helper
<?php
/**
* @package MyExtension.Library
* @subpackage Helper
*
* @copyright Copyright (C) 2014 Roberto Segura. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
@mbabker
mbabker / passwordReset.php
Last active August 29, 2015 13:58
This CLI script enables site administrators to require their site users to reset their password if they have not done so within a specified number of days
<?php
/**
* Password Reset Script
*
* This command line script can be run as a cron job or on user request to flag user accounts on a site
* as requiring their passwords reset. This script flags all users who have not reset their passwords
* in the number of days specified by the user and compares to the lastResetTime column in the #__users
* table.
*
* The number of days can be specified in one of two manners:
@rdeutz
rdeutz / gist:6988153
Last active December 25, 2015 13:59
Multilanguage Frontpage check
/**
* frontpage check
*/
$menu = JFactory::getApplication()->getMenu();
$defaultmenuitems = array($menu->getDefault()->id, $menu->getDefault(JFactory::getLanguage()->getTag())->id);
$isFrontpage = in_array($menu->getActive()->id, $defaultmenuitems);