Skip to content

Instantly share code, notes, and snippets.

View fabianx-ai's full-sized avatar

Fabian Franz fabianx-ai

  • LionsAd
  • Schweiz
View GitHub Profile
@fabianx-ai
fabianx-ai / format-patch--directory.sh
Last active August 14, 2020 20:19
Re-create commit history of one folder including all subcommits with 2nd chance for conflicting merges
RANGE="$1"
NAME="$2"
SITE="$3"
OUTPUT="$4"
DIR="docroot/sites/all/modules/custom/${NAME}/"
# Get a list of all relevant commits
LIST=$(git log --oneline --first-parent --reverse ${RANGE} -- ${DIR});
I=0;
@fabianx-ai
fabianx-ai / Lazy-Load-Scripts-In-Order.md
Last active July 4, 2022 16:40
Lazy Load Javascript in Order

Introduction

Lazy loading scripts is a very good idea, because Javascript should be a progressive enhancement and not mandatory.

I know that's old school, but I still believe in that vision of the Web.

Jake Archibald tried this in 2013 (https://www.html5rocks.com/en/tutorials/speed/script-loading/) and kinda resigned "That. At the end of the body element.".

Much has changed since then and the programmatic way of loading the scripts as async works now. (https://www.html5rocks.com/en/tutorials/speed/script-loading/#toc-dom-rescue):

@fabianx-ai
fabianx-ai / response-to-real-differences-between-ot-and-crdt-for-co-editors.md
Last active July 13, 2019 06:09
Response to "Real Differences between OT and CRDT for Co-Editors"

To: Chengzheng Sun, David Sun, Agustina, Weiwei Cai

Thanks for the paper, it was very interesting to read.

Unfortunately the paper is having a strong direction of:

CRDT vs. OT

but that is not helpful in practice.

@fabianx-ai
fabianx-ai / ShmBackend.php
Created April 7, 2019 18:18
ShmBackend for ChainedFast
<?php
namespace Drupal\Core\Cache;
use Drupal\Component\Assertion\Inspector;
/**
* Stores cache items in /dev/shm.
*/
class ShmBackend implements CacheBackendInterface {
@fabianx-ai
fabianx-ai / CFBackendPatch.diff
Created April 7, 2019 18:16
CFBackendPatch.diff
diff --git a/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php b/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
--- a/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
+++ b/web/core/lib/Drupal/Core/Cache/ApcuBackendFactory.php
@@ -46,6 +46,9 @@ public function __construct($root, $site_path, CacheTagsChecksumInterface $check
else {
$this->backendClass = 'Drupal\Core\Cache\Apcu4Backend';
}
+
+ $this->backendClass = 'Drupal\Core\Cache\CFAwareApcuBackend';
+ //$this->backendClass = 'Drupal\Core\Cache\ShmBackend';
@fabianx-ai
fabianx-ai / CFAwareApcuBackend.php
Last active November 21, 2018 20:37
CFAwareApcuBackend -- ChainedFastAware APCu Cache backend
<?php
namespace Drupal\Core\Cache;
use Drupal\Component\Assertion\Inspector;
/**
* Stores cache items in the Alternative PHP Cache User Cache (APCu).
*/
class CFAwareApcuBackend extends ApcuBackend {
@fabianx-ai
fabianx-ai / spectre-thread.c
Last active February 21, 2019 17:42 — forked from ErikAugust/spectre.c
Spectre example code - using threads and showing detailed statistics
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
<?php
function yac_store() {
static $yac;
if (!isset($yac)) {
$yac = new Yac('');
}
return $yac;
<?php
/**
* @file
*
* Contains Drupal\newsletter_view\Controller\NewsletterViewNodeController
*/
namespace Drupal\newsletter_view\Controller;