Skip to content

Instantly share code, notes, and snippets.

View aquelito's full-sized avatar

Axel Roche aquelito

  • Craftsman developer
  • France
View GitHub Profile
@stewartmcgown
stewartmcgown / partialMatch.js
Created January 15, 2019 12:03
Partial Match properties of Object Array (ES6)
/**
* Are all the values on p present on o
* @param {Object} o object to search
* @param {Object} p object of search values
* @param {Boolean} [c] are loose equality matches ok?
* @return {Boolean} whether there are partial matches
*/
const partialMatch = (o, p, c) =>
Object.keys(p).every(k =>
p[k] && o[k]
@kevinswiber
kevinswiber / backends.js
Last active February 6, 2024 18:56
Express Gateway Example with Multiple Services
const express = require('express');
const forum = express();
forum
.get('/healthz', (req, res, next) => {
res.send({ name: 'forum', status: 'healthy' });
next();
})
.get('/d/:id', (req, res, next) => {
@facultymatt
facultymatt / roles_invesitgation.md
Last active April 16, 2024 09:31
Roles and permissions system for Nodejs
@davidjguru
davidjguru / Blocks.md
Created November 12, 2020 17:47 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@cesarmiquel
cesarmiquel / drupal-8-cheatsheet.md
Last active May 3, 2024 14:26
Drupal 8/9/10 Cheatsheet

Drupal 8 Cheatsheet

Files, Images and Media

// Load file object
$file = File::load($fid);

// Get uri (public://foo/bar/baz.png)
$uri = $file->getFileUri();