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 July 22, 2024 08:58
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

@Leksat
Leksat / copy.js
Last active May 23, 2023 09:44
Copy bookmarklet for Jira
javascript:(function(){
const ticketNumber =
/* If we are on a Jira board. */
location.search.match('[?&]selectedIssue=(.*?)([&]|$)')?.[1] ||
/* If we are on the ticket page. */
location.pathname.split('/').pop();
const ticketSummary = document.getElementsByTagName('h1')[document.getElementsByTagName('h1').length-1].textContent.trim();
const ticketUrl = `${location.origin}/browse/${ticketNumber}`;
const html = `<a href="${ticketUrl}">${ticketNumber} [${ticketSummary}]</a>`;
const text = `[${ticketNumber} ${ticketSummary}](${ticketUrl})`;
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 22, 2024 07:04
Conventional Commits Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@chx
chx / EntityArrayHelper.php
Created December 6, 2018 19:04
Helper for migrations with paragraphs
<?php
namespace Drupal\sd8;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
/**
* Convert an entity to an array and back.
*/
@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 July 22, 2024 06:03
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.