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 | |
/** | |
* Implements template_preprocess_commerce_product(). | |
*/ | |
function dotorg_shop_default_preprocess_commerce_product(&$variables) { | |
if (isset($variables['elements']['#commerce_product'])) { | |
// Get view mode & assign variable. | |
$view_mode = $variables['elements']['#view_mode']; | |
$variables['view_mode'] = $view_mode; |
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\commerce_icu_post_checkout\EventSubscriber; | |
use Drupal\commerce_icu_post_checkout\AutoFulfillmentManagerInterface; | |
use Drupal\commerce_order\Entity\OrderInterface; | |
use Drupal\state_machine\Event\WorkflowTransitionEvent; | |
use Psr\Log\LoggerInterface; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
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
#!/usr/bin/env ruby | |
# | |
# Email grepper: Read stuff from STDIN in 4k chunks, look for anything | |
# resembling an email, dump results to recovery directory | |
RECOVERY_DIR = '/enter/a/recovery/directory/here'.freeze | |
EMAIL_REGEX = /Received: |Subject: |Return-path: |Return-Path: / | |
NULL_BYTE = "\000".freeze | |
OUT_FILE_PREFIX = 'chunk-'.freeze | |
MODE = "w".freeze |
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
#!/usr/bin/env ruby | |
require 'ohm' | |
module SomeNamespace | |
class Post < Ohm::Model | |
attribute :title | |
attribute :body | |
collection :comments, Comment | |
end |