assoc .sh=ShellScript
ftype ShellScript="D:\Programs\Coding\Cygwin\bin\bash.exe" "%1" %*
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
// ==UserScript== | |
// @name xDebug helper | |
// @namespace http://xandeadx.ru/ | |
// @version 0.1 | |
// @author xandeadx | |
// @match http://*.local/* | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.0/js.cookie.js | |
// ==/UserScript== |
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
$queue = \Drupal::queue('my_custom_queue'); | |
$queue->deleteQueue(); | |
$queue->createQueue(); | |
timer_start(); | |
for ($i = 0; $i < 10000; $i++) { | |
$queue->createItem([ | |
'key' => 'value', | |
'nested' => [ | |
'key' => 'value' | |
] |
assoc .sh=ShellScript
ftype ShellScript=wt -p "Cygwin BASH" "D:\Programs\Coding\Cygwin\bin\bash.exe" "%1" %*
Cygwin BASH
it's Windows Terminal profile name.
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
$products_displays = node_load_multiple([], ['type' => 'product_display']); | |
foreach ($products_displays as $product_display) { | |
$product_id = $product_display->field_product['und'][0]['product_id']; | |
$product = commerce_product_load($product_id); | |
foreach ($product_display as $product_display_field_name => $product_display_field_value) { | |
if (strpos($product_display_field_name, 'field_product_') === 0 && $product_display_field_value && isset($product->{$product_display_field_name})) { | |
$product->{$product_display_field_name} = $product_display_field_value; | |
} | |
} |
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 | |
$directory = $argv[1] ?? ''; | |
$direction = $argv[2] ?? ''; | |
if (!$directory || !in_array($direction, ['prev', 'next'])) { | |
exit('Invalid parameters'); | |
} | |
$directory = rtrim($directory, DIRECTORY_SEPARATOR); |
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
(function ($) { | |
Drupal.behaviors.test = { | |
attach: function (context, settings) { | |
$('input[data-autocomplete-extra-data-selector]', context).bind('autocompleteSelect', function (event) { | |
var $input = $(this); | |
var $targetElement = $($input.data('autocomplete-extra-data-selector')); | |
if ($targetElement.length) { | |
var matches = $input.val().match(/(.+) \[(.+)\]/); | |
$input.val(matches[1]); | |
$targetElement.val(matches[2]); |
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
composer create-project drupal/drupal . --no-dev | |
composer require drupal/core --update-no-dev |
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
class helper_handler_sort_mysort extends views_handler_sort { | |
function options_form(&$form, &$form_state) { | |
parent::options_form($form, $form_state); | |
$relationships = $this->view->display_handler->get_option('relationships'); | |
$relationship_options = array('none' => t('Do not use a relationship')); | |
foreach ($relationships as $relationship) { | |
$relationship_handler = views_get_handler($relationship['table'], $relationship['field'], 'relationship'); | |
$relationship_handler->init($this->view, $relationship); |