Skip to content

Instantly share code, notes, and snippets.

View dstorozhuk's full-sized avatar

Dima dstorozhuk

View GitHub Profile
@dstorozhuk
dstorozhuk / ionos.sh
Created November 17, 2023 13:23 — forked from leymannx/ionos.sh
1&1 ionos shared webhosting command line PHP Drush Composer Drupal
# https://www.ionos.com/community/hosting/php/using-php-composer-in-11-ionos-webhosting-packages/
php -v
# PHP 4.4.9 (cgi-fcgi) (built: Nov 7 2018 13:27:00)
# Copyright (c) 1997-2008 The PHP Group
# Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
/usr/bin/php7.1-cli -v
# PHP 7.1.25 (cli) (built: Dec 10 2018 10:11:36) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
@dstorozhuk
dstorozhuk / TermReferenceBoost.php
Created October 1, 2020 14:03 — forked from schnippy/TermReferenceBoost.php
Drupal 8.x Search API processor plugin for boosting search items by term reference field
<?php
// This plugin allows the administrator to boost items in an index based on a taxonomy term.
//
// Drop into an existing plugin module or create a new one, ex. create an info.yml file as
// modules/custom/search_api_boost_term_reference/search_api_boost_term_reference.info.yml
//
// name: 'Search API Boost by Term Reference'
// description: 'Define custom boost priority in Search API index by term reference field'
// core: 8.x

The Scroll Behavior specification has been introduced as an extension of the Window interface to allow for the developer to opt in to native smooth scrolling. To date this has only been implemented in Chrome, Firefox and Opera.

There's a complete polyfill here (3.3KB minified). But most of the times, the following is enough for me (641 bytes minified):

smooth-scrolling-poyfill.js

Use as: scrollToElem('#elem-selector');

@dstorozhuk
dstorozhuk / import.php
Last active May 8, 2020 05:30 — forked from crittermike/import.php
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');