Skip to content

Instantly share code, notes, and snippets.

@rxaviers
rxaviers / gist:7360908
Last active April 19, 2024 10:02
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@ken-muturi
ken-muturi / new_gist_file.php
Created November 17, 2013 07:03
Countries array
<?php
// https://snipt.net/public/tag/php/?page=3
$countries = array(
"AF" => array("country" => "Afghanistan", "continent" => "Asia"),
"AX" => array("country" => "Åland Islands", "continent" => "Europe"),
"AL" => array("country" => "Albania", "continent" => "Europe"),
"DZ" => array("country" => "Algeria", "continent" => "Africa"),
"AS" => array("country" => "American Samoa", "continent" => "Oceania"),
@crittermike
crittermike / ExampleModuleController.php
Last active June 17, 2021 12:55
Example of overriding a route controller in Drupal 8
<?php
/**
* @file
* Contains \Drupal\example_module\Controller\ExampleModuleController.
*/
// THIS FILE BELONGS AT /example_module/src/Controller/ExampleModuleController.php
namespace Drupal\example_module\Controller;
@luksak
luksak / CustomShippingInformation.php
Created October 8, 2017 13:19
Commerce shippping pane that automatically chooses a shipping method without providing a UI for the cutomer
<?php
namespace Drupal\MODULE\Plugin\Commerce\CheckoutPane;
use Drupal\commerce_shipping\Entity\ShipmentInterface;
use Drupal\commerce_shipping\Entity\ShippingMethod;
use Drupal\commerce_shipping\Plugin\Commerce\CheckoutPane\ShippingInformation;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@luksak
luksak / CartEventSubscriber.php
Last active October 19, 2017 18:14
Display message if order total is below a certain amount such as to get free shipping after adding products to the cart and when viewing the cart page.
<?php
namespace Drupal\MODULE\EventSubscriber;
use Drupal\commerce_order\Entity\Order;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\commerce_cart\Event\CartEntityAddEvent;
use Drupal\commerce_cart\Event\CartEvents;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@jmolivas
jmolivas / ._README.md
Last active January 2, 2018 15:57
Basic docker configuration for drupal projects

Basic docker configuration for drupal projects

Extra steps

  1. If not using DrupalConsole you will need to add the vlucas/phpdotenv dependency to load the .env file. You can do that using composer:
composer require vlucas/phpdotenv
  1. Add the TRAEFIK_HOST value to /etc/hosts
@clrockwell
clrockwell / PromotionAdvanced.php
Created December 6, 2017 21:50
commerce_order_report plugin
<?php
namespace Drupal\scholarrx_reports\Plugin\Commerce\ReportType;
use Drupal\commerce_order\Adjustment;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_order\Entity\OrderItemInterface;
use Drupal\commerce_promotion\Entity\CouponInterface;
use Drupal\commerce_promotion\Entity\Promotion;
use Drupal\commerce_reports\Annotation\CommerceReportType;
@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
<?php
/**
* @When I switch to the frame by selector "[title=:arg1]"
*/
public function switchToIFrameFromSelector($iframeSelector) {
$function = <<<JS
(function(){var iframe = document.querySelector("$iframeSelector");iframe.name = "iframeToSwitchTo";})()
JS;
try {
@andypost
andypost / docker-compose.yaml
Last active August 8, 2022 05:49
Drupal 8 template for core dev + chromium
version: "2.1"
services:
php:
image: skilldlabs/php:8-fpm
container_name: core8
restart: always
working_dir: /var/www/html/web
volumes: