This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\media\Entity\Media; | |
use Drupal\file\Entity\File; | |
/** | |
* Create media entities from existing file fields. | |
*/ | |
function mymodule_update_8801() { | |
$converts = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Rename utility. | |
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |
echo "usage: $(basename $0) FILE [...]" | |
echo | |
exit 0 | |
fi | |
IFS=$' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will download video from online video service website. | |
# sudo apt install html-xml-utils | |
# Usage ./video-service-movie-download.sh https://somewhere-online-movie.web/best-movie.html | |
if [ -z "$1" ]; then | |
echo "No url supplied. Please set collection name. (ex: https://somewhere-online-movie.web/best-movie.html)" | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo rfkill block bluetooth | |
sudo rfkill unblock bluetooth | |
sudo systemctl restart bluetooth | |
# Change MAC address to fit your device. | |
DEVICE_MAC='12:12:12:12:12:12' | |
CARD_ID=$(pactl list short cards | grep "module-bluez5-device.c" | awk '{ print $1 }') | |
# Should check here if card is available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Normalizer; | |
use Drupal\commerce_product\Entity\ProductVariationInterface; | |
use Drupal\Core\TypedData\TypedDataInternalPropertiesHelper; | |
use Drupal\serialization\Normalizer\NormalizerBase; | |
/** | |
* Converts typed data objects to arrays. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_commerce\Normalizer; | |
use Drupal\commerce_product\Entity\ProductVariationInterface; | |
use Drupal\Core\TypedData\TypedDataInternalPropertiesHelper; | |
use Drupal\serialization\Normalizer\NormalizerBase; | |
/** | |
* Converts typed data objects to arrays. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Plugin\Field\FieldFormatter; | |
use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter; | |
use Drupal\Core\Field\FieldItemListInterface; | |
use Drupal\Core\Cache\Cache; | |
/** | |
* Plugin implementation of the 'image_default_fallback' formatter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# store arguments in a special array | |
args=("$@") | |
URL=${args[0]} | |
# Check if link to page is present. | |
if [ -z "$URL" ]; then | |
echo "No url supplied. Please set collection name. (ex: https://readukrainianbooks.com/6340-faktor-cherchillja-jak-odna-ljudina-zminila-istoriju-boris-dzhonson.html)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Store arguments in a special array | |
args=("$@") | |
URL=${args[0]} | |
# Check if link to page is present. | |
if [ -z "$URL" ]; then | |
echo "No url supplied. Please set collection name. (ex: https://booknet.ua/reader/smttyar-b155659)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Plugin\Commerce\Condition; | |
use Drupal\commerce\EntityUuidMapperInterface; | |
use Drupal\commerce\Plugin\Commerce\Condition\ConditionBase; | |
use Drupal\commerce_product\Plugin\Commerce\Condition\ProductTrait; | |
use Drupal\commerce\Plugin\Commerce\Condition\PurchasableEntityConditionInterface; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Entity\EntityTypeManagerInterface; |