This file contains hidden or 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
| // Drupal creates aggregated CSS file based on URL. The URL of aggreated css files looks like this. | |
| // /sites/default/files/css/css_r2mI5EYphoR4On2HmnhByWxu6QR1_AhZ5GtagUZw2aE.css?delta=1&language=en&theme=particle&include=eJxtUttyxCAI_SG7vuz_MMQQl6yKFdJp-vUlO53upX1RDiAHDqIqGXBbKZmMuGrUxaHRwGQsDdS2mQXog0bGTAH_PrjgILuwgqbB3UJKC3QaKg0Lf-FRJvYhVWDh4pXDIqMedepU9vgIYNWQRXIhMMwHaTON5r1cueXQpZQ4j61jOR32W-F21aC7GtU4oVLoOIxToZhkUFjfNxo7bAwmUox7_LlvPSaRKxN0d8UX7JWngWO_5WWEbDXezZfo-SF8forfZ4nufoaYX_EJV_wM6Uozu7SAyWeYD_F-rdMyxHfT5rCqt1u7NFfoRo0M6YI2iZ3uZvAo2w4uLs0xYT92cdeoOhPChK35UgYl7uQrajM5-VzZiY_zpt2EA9KmJtV_xF5I_82v1Db4YOWJi_N-AwqU7mo | |
| // Where include parameter decides what all the files to include in aggregated css. You can decode this with below script. | |
| $include_param = 'eJxtUt16wyAIfSFXb_o-fESJIzWSAXbL28_069at241yOPzIQTQjB24LJReNi0WbB3RSTM7SwLxnFqAracFCAf8mvKKSv7KBJeXNwyy6HmHrVPf4E8BioYiUSuBYjprNLfpodeFWwia1xqx9w3o67JfK7WLBdnNa44RGYUN1TpViEqWwvHXSHTqDi1TnLd7vkNIMSeTCBNtwxSc8Kk-Kut_iCkLxNT7MJ_b8gz7_4h-zxOH-DbE84x |
This file contains hidden or 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
| const listeners = (function listAllEventListeners() { | |
| let elements = []; | |
| const allElements = document.querySelectorAll('*'); | |
| const types = []; | |
| for (let ev in window) { | |
| if (/^on/.test(ev)) types[types.length] = ev; | |
| } | |
| for (let i = 0; i < allElements.length; i++) { | |
| const currentElement = allElements[i]; |
This file contains hidden or 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
| { | |
| // Use IntelliSense to learn about possible attributes. | |
| // Hover to view descriptions of existing attributes. | |
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Listen for Xdebug", | |
| "type": "php", | |
| "request": "launch", |
This file contains hidden or 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
| def export_recipes_to_csv(event): | |
| """ | |
| Exports recipes to a CSV file. | |
| :param recipe_list: List of recipe dictionaries. | |
| :param filename: Output CSV file name. | |
| """ | |
| body = json.loads(event.get("body", "{}")) | |
| # Get the list of recipe IDs from the request body. | |
| recipe_ids = body.get("recipe_ids", []) # List of recipe IDs. |
This file contains hidden or 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 | |
| for i in {2..100}; do | |
| # Your code to be executed in each iteration goes here | |
| echo "Script 1 Iteration: $i" | |
| sleep 1 | |
| done |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| function getColorfulString() { | |
| RED='\033[0;31m' | |
| NC='\033[0m' # No Color | |
| # 30-37 sets foreground color | |
| # 40-47 sets background color | |
| echo "$RED$1$NC" | |
| } |
This file contains hidden or 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
| def kaprekar_constant(num): | |
| steps = 0 | |
| while num != 6174: | |
| # Convert number to a 4-digit string, padding with zeros if necessary | |
| num_str = f"{num:04d}" | |
| # Sort digits in ascending and descending order | |
| asc = int(''.join(sorted(num_str))) | |
| desc = int(''.join(sorted(num_str, reverse=True))) |
This file contains hidden or 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 | |
| // Problem | |
| /** | |
| * Review the code: | |
| * 1) Find errors | |
| * 2) What would be improved from the design point of view? | |
| * How to get rid of implementing not used methods in the child classes? | |
| * 3) Implement a counter for the created instances of any class from the hierarchy. | |
| * 4) Implement getCategory method so it returns the value of the constant | |
| * defined in the child class. |
This file contains hidden or 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 | |
| // How to create horizontal tabs programmatically in Drupal 8, requires Field Group module | |
| $form = array(); | |
| $form['my_field'] = array( | |
| '#type' => 'horizontal_tabs', | |
| '#tree' => TRUE, | |
| '#prefix' => '<div id="unique-wrapper">', | |
| '#suffix' => '</div>', | |
| ); | |
| $items = array( |
This file contains hidden or 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\mymodule\Plugin\views\filter; | |
| use Drupal\views\Plugin\views\filter\FilterPluginBase; | |
| use Drupal\Core\Form\FormStateInterface; | |
| use Geocoder\Formatter\StringFormatter; | |
| use Drupal\user\Entity\User; | |
| /** |
NewerOlder