Skip to content

Instantly share code, notes, and snippets.

View superbiche's full-sized avatar
🕹️
Working from everywhere

Michel Tomas superbiche

🕹️
Working from everywhere
View GitHub Profile
@superbiche
superbiche / 196-arrayaccess-type-compatibility.patch
Last active March 27, 2022 19:35
Sendinblue PHP SDK v3 - PHP 8.1 GetLists ArrayAccess fix
diff --git a/lib/Model/AbTestCampaignResult.php b/lib/Model/AbTestCampaignResult.php
index 8d8e1cb..a605944 100644
--- a/lib/Model/AbTestCampaignResult.php
+++ b/lib/Model/AbTestCampaignResult.php
@@ -200,9 +200,9 @@ class AbTestCampaignResult implements ModelInterface, ArrayAccess
const WINNING_VERSION_B = 'B';
const WINNING_CRITERIA_OPEN = 'Open';
const WINNING_CRITERIA_CLICK = 'Click';
-
@superbiche
superbiche / install-composer.sh
Created February 5, 2022 19:46
Install Composer programmatically
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
diff --git a/block_breakpoint.module b/block_breakpoint.module
index b3d0f4b..1a6d711 100644
--- a/block_breakpoint.module
+++ b/block_breakpoint.module
@@ -51,7 +51,7 @@ function block_breakpoint_form_layout_builder_configure_block_alter(&$form, Form
*/
function block_breakpoint_preprocess_layout(&$variables) {
$layout = $variables['layout'] ?? NULL;
- if ($regions = $layout->getRegionNames()) {
+ if (is_object($layout) && is_callable('getRegionNames', $layout) && $regions = $layout->getRegionNames()) {
diff --git a/composer.json b/composer.json
index 7de7360..ff39c55 100644
--- a/composer.json
+++ b/composer.json
@@ -17,6 +17,6 @@
},
"license": "GPL-2.0+",
"require": {
- "php": "^7.1"
+ "php": "^7.1|^8.0"
@superbiche
superbiche / drupal-block-breakpoint.patch
Last active August 18, 2021 12:20
Drupal block_breakpoint I'm working on
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9f11b75
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea/
diff --git a/config/schema/block_breakpoint.schema.yml b/config/schema/block_breakpoint.schema.yml
index 9e94a14..8bf3b08 100644
--- a/config/schema/block_breakpoint.schema.yml
@superbiche
superbiche / cache-warmer.py
Last active June 21, 2020 00:17 — forked from hn-support/cache-warmer.py
A threaded cache warmer in python
#!/usr/bin/env python
"""
Warm the caches of your website by crawling each page defined in sitemap.xml (can use a local file or an URL).
To use, download this file and make it executable. Then run:
./cache-warmer.py --threads 4 --url http://example.com/sitemap.xml -v
"""
import argparse
import multiprocessing.pool as mpool
import os.path
import re

Keybase proof

I hereby claim:

  • I am superbiche on github.
  • I am superbiche (https://keybase.io/superbiche) on keybase.
  • I have a public key whose fingerprint is E8B7 EB88 FC66 D8EC 742E 3EF9 E37D EC39 DC4D 305C

To claim this, I am signing this object:

@superbiche
superbiche / graph_models.md
Created August 15, 2019 21:20 — forked from rg3915/graph_models.md
Generate graphic model Django with PyGraphViz

How to generate graphic model Django with PyGraphViz?

sudo apt-get install graphviz libgraphviz-dev pkg-config
virtualenv -p python2.7 .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pygraphviz
pip uninstall pyparsing
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
diff --git a/simple_oauth.module b/simple_oauth.module
index deba4e1..b4e7904 100644
--- a/simple_oauth.module
+++ b/simple_oauth.module
@@ -19,19 +19,20 @@ use Drupal\user\RoleInterface;
/**
* Implements hook_cron().
*/
+
function simple_oauth_cron() {
@superbiche
superbiche / glustertop.py
Created May 28, 2019 00:17 — forked from fpytloun/glustertop.py
Real time GlusterFS top-like monitoring
#!/usr/bin/env python
"""
Display gluster traffic
This tool uses gluster profiling feature, parsing cumulative statistics.
To understand correctly the results, you have to divide overall write statistics with number of replicas.
Also striped volumes needs to be taken in mind - overall statistics just print sum of all bricks
read/written bytes.