Skip to content

Instantly share code, notes, and snippets.

🖖
Live long and prosper

Dan Braghis zerolab

🖖
Live long and prosper
Block or report user

Report or block zerolab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zerolab
zerolab / cf-holding-page.js
Created Mar 30, 2020
Cloudflare Worker holding page
View cf-holding-page.js
addEventListener("fetch", event => {
event.respondWith(fetchAndReplace(event.request))
})
async function fetchAndReplace(request) {
let modifiedHeaders = new Headers()
modifiedHeaders.set('Content-Type', 'text/html')
modifiedHeaders.append('Pragma', 'no-cache')
@zerolab
zerolab / github_actions_deploy-mkdocs-to-gh-pages.yaml
Created Mar 11, 2020
Sample mkdocs deployment to GitHub Pages action
View github_actions_deploy-mkdocs-to-gh-pages.yaml
name: MkDocs to GitHub Pages
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
deploy:
@zerolab
zerolab / menu_children.html
Last active Feb 24, 2020
Wagtail "native" menus
View menu_children.html
# myapp/templates/tags/menu_children.html
{% load wagtailcore_tags %}
<ul class="primary-children">
{% for child in menuitems_children %}
<li{% if child.is_active %} class="active"{% endif %}><a href="{% pageurl child %}">{{ child.title }}</a></li>
{% endfor %}
</ul>
@zerolab
zerolab / responsiveimage_tags.py
Created Jun 20, 2019
Wagtail responsive image tag
View responsiveimage_tags.py
from django import template
from wagtail.images.models import SourceImageIOError
from wagtail.images.shortcuts import get_rendition_or_not_found
from wagtail.images.templatetags.wagtailimages_tags import ImageNode
register = template.Library()
@register.tag(name="responsiveimage")
View commerce-payment-process-log-duplicates.patch
diff --git a/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php b/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php
index ff9f91bf..d5dec4bc 100644
--- a/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php
+++ b/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php
@@ -157,6 +157,33 @@ public function buildPaneForm(array $pane_form, FormStateInterface $form_state,
$payment_gateway_plugin = $payment_gateway->getPlugin();
$payment_storage = $this->entityTypeManager->getStorage('commerce_payment');
+
+ $existing_payment_ids = $payment_storage->getQuery()
@zerolab
zerolab / content_taxonomy_tid_formatter.patch
Last active May 24, 2018
D6 node / term refence id formatter
View content_taxonomy_tid_formatter.patch
diff --git a/content_taxonomy.module b/content_taxonomy.module
index 537f3d09..81af581e 100644
--- a/content_taxonomy.module
+++ b/content_taxonomy.module
@@ -37,6 +37,9 @@ function content_taxonomy_theme() {
'content_taxonomy_formatter_link' => array(
'arguments' => array('element' => NULL),
),
+ 'content_taxonomy_formatter_tid' => array(
+ 'arguments' => array('element' => NULL),
View og-333-231-181-fixer.patch
diff --git a/src/GroupTypeManager.php b/src/GroupTypeManager.php
index 69c391dfe..421c645cf 100644
--- a/src/GroupTypeManager.php
+++ b/src/GroupTypeManager.php
@@ -198,9 +198,9 @@ public function getGroupsForEntityType($entity_type_id) {
/**
* {@inheritdoc}
*/
- public function getAllGroupBundles() {
- // Todo - should be remove since this method don't do any thing.
@zerolab
zerolab / 231-admin-routes-merge.diff
Last active Nov 3, 2017
OG PR 231 - admin routes fix
View 231-admin-routes-merge.diff
diff --git a/src/Event/OgAdminRoutesEvent.php b/src/Event/OgAdminRoutesEvent.php
index bb506ee9d..4ae012172 100644
--- a/web/modules/contrib/og/src/Event/OgAdminRoutesEvent.php
+++ b/web/modules/contrib/og/src/Event/OgAdminRoutesEvent.php
@@ -43,7 +43,7 @@ public function getRoutes($entity_type_id) {
// Add default values. NestedArray::mergeDeep allows deep data to not be
// overwritten with the defaults.
- $routes_info[$name] = NestedArray::mergeDeep($routes_info[$name], [
+ $defaults = [
@zerolab
zerolab / phpunit_die_verbose.php
Created Oct 27, 2017
Make PHPUnit verbose instead of dying silently
View phpunit_die_verbose.php
// PHPUnit dies silently with FATAL ERRORS which
// makes it hard to debug the tests.
// For D8, add this to the end of web/core/tests/bootstrap.php.
//
// @see https://stackoverflow.com/a/33578611/201316
register_shutdown_function('PHPUnit_shutdownFunction');
function PHPUnit_shutdownFunction() {
// @see http://www.php.net/manual/en/errorfunc.constants.php
$error = error_get_last();
if (!is_null($error)) {
You can’t perform that action at this time.