Skip to content

Instantly share code, notes, and snippets.

View Septdir's full-sized avatar

Igor Berdichevskiy Septdir

View GitHub Profile
@AlekVolsk
AlekVolsk / polyfills.js
Created May 31, 2019 16:15
IE11 polyfill's: matches, closest, forEach
(function () {
// matches
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.matchesSelector ||
Element.prototype.webkitMatchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector;
}
@AlekVolsk
AlekVolsk / table_search.js
Last active May 30, 2019 15:29
Search on table
function tableSearch(searchId, tableId) {
var phrase = document.getElementById(searchId);
var table = document.getElementById(tableId);
var regPhrase = new RegExp(phrase.value, 'i');
for (var i = 1; i < table.rows.length; i++) {
flag = regPhrase.test(table.rows[i].cells[0].innerHTML);
if (flag) {
table.rows[i].style.display = '';
} else {
table.rows[i].style.display = 'none';
@kernusr
kernusr / createMenuItem.php
Last active July 5, 2019 07:59
Programmatically add menu item in Joomla!
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Table\Table;
protected function addMenuItem($data){
$app = Factory::getApplication();
@progreccor
progreccor / downloadlatestJoomla.sh
Last active April 3, 2019 19:43
Download latest Joomla release in to the directory and untar it
GREEN='\033[0;32m'
RED='\033[0;31m'
WHITE='\033[0m'
site=test.ru
directory="/var/www/html"
adr=$( curl -s https://api.github.com/repos/joomla/joomla-cms/releases/latest | grep browser_download_url.*Stable-Full_Package.tar.gz | awk '{ print $2 }' | tr -d \" )
cd $directory
wget $adr
tar xvzf *Stable-Full_Package.tar.gz -C $directory/$site
rm $directory/*Stable-Full_Package.tar.gz
@AlekVolsk
AlekVolsk / info_browser.php
Last active January 10, 2022 01:32
getInfoBrowser()
<?php
function getInfoBrowser($agent = '')
{
if (empty($agent)) {
$agent = $_SERVER['HTTP_USER_AGENT'];
}
$browserInfo = [];
$browserInfo['ip'] = $_SERVER['REMOTE_ADDR'];
@CB9TOIIIA
CB9TOIIIA / stubs.php
Created September 26, 2017 10:00
stubs.php PhpStorm
<?php
class JRegistry extends \Joomla\Registry\Registry {}
abstract class JRegistryFormat extends \Joomla\Registry\AbstractRegistryFormat {}
class JRegistryFormatIni extends \Joomla\Registry\Format\Ini {}
class JRegistryFormatJson extends \Joomla\Registry\Format\Json {}
class JRegistryFormatPhp extends \Joomla\Registry\Format\Php {}
class JRegistryFormatXml extends \Joomla\Registry\Format\Xml {}
class JStringInflector extends \Joomla\String\Inflector {}
abstract class JStringNormalise extends \Joomla\String\Normalise {}
class JData extends \Joomla\Data\DataObject {}
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Sitemap</title>