Skip to content

Instantly share code, notes, and snippets.

View colorfield's full-sized avatar

Christophe Jossart colorfield

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active August 17, 2026 20:05
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@tobybellwood
tobybellwood / image_replacement.md
Last active February 1, 2022 13:36
lagoon-images reference

The following is a table to indicate how users of the current amazeeio-namespaced Lagoon images can upgrade seamlessly to the new uselagoon-namespaced ones.

This brings with it a number of improvements:

  • Versioning is now available for a number of images that previously were susceptible to major version increments (mariadb, postgres, redis, varnish), ensuring more predictability
  • ARM (Apple Silicon) compatibility is only available in uselagoon-namespaced & versioned images
  • Automated updates via GitHub/Dependabot, RenovateBot etc are much easier under the new versioning system

For more information see the blog series at https://dev.to/uselagoon/moving-lagoon-to-semantic-versioned-docker-images-57d0

To use the table below - find the image you currently use in the "Old Image" column, and replace it with the "New Image" in your Dockerfile/docker-compose.yml

@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active November 15, 2026 03:00
Conventional Commits Cheatsheet
@dunglas
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@teglia
teglia / FCEntityMigrate.php
Last active December 12, 2023 13:21
Migrating Field Collections to Paragraphs on an empty Drupal 8 site WITHOUT migrate_tools or migrate_plus
<?php
namespace Drupal\migrate_custom\Plugin\migrate\source;
use Drupal\Core\Database\Query\Condition;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Drupal 7 file source from database.
@webchick
webchick / most_starred_projects
Last active September 22, 2017 07:16
Projects with the most stars on Drupal.org
mysql> SELECT n.nid, n.title, c.count AS stars
-> FROM node n
-> INNER JOIN flag_counts c ON c.entity_id = n.nid
-> WHERE c.fid = 14
-> ORDER BY c.count DESC
-> LIMIT 50;
+---------+---------------------------------------------+-------+
| nid | title | stars |
+---------+---------------------------------------------+-------+
| 605898 | Drupal Commerce | 148 |
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active November 14, 2026 19:33
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

The JSON API specification is agnostic about how a server implements filtering strategies. In fact, the spec says:

Note: JSON API is agnostic about the strategies supported by a server. The filter query parameter can be used as the basis for any number of filtering strategies.

<?php
/**
* This plugin creates a new paragraph entity based on the source.
*
* @MigrateProcessPlugin(
* id = "mds_paragraph"
* )
*/
class ParagraphMigrateProcessor extends ParagraphProcessBase {