Skip to content

Instantly share code, notes, and snippets.

View bhanu951's full-sized avatar

Bhanu bhanu951

  • India
View GitHub Profile
@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');
@jdecode
jdecode / dockerfile-for-php80-rc2-mysql-postgres.md
Last active December 19, 2024 08:14
Dockerfile for PHP 8.0 RC2 with MySQL and Postgres support
@spotzero
spotzero / Makefile
Last active April 2, 2024 14:54
Very Simple Podman and Buildah Makefile for Drupal local dev and beyond with Solr support
# Quick and lean Drupal local dev with Podman and an unpriviledged user.
#
# To use, run the following:
# 1. projectname="myproject"
# 2. composer create-project drupal-composer/drupal-project:8.x-dev $projectname --no-interaction
# 3. cd $projectname
# 4. curl -o Makefile https://gist.githubusercontent.com/spotzero/18fd821cb9081c666a629e940f166f52/raw
# 5. make start
# 6. make install
#
@bdlangton
bdlangton / Blocks.md
Last active February 3, 2026 12:41
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 December 6, 2025 04:14
Drupal 8/9/10 Cheatsheet

Drupal 8/9/10 Cheatsheet

[Update 2024] - Take a look at Drupal at your fingertips. Lot's of great stuff there.

Files, Images and Media

// Load file object
$file = File::load($fid);
@mihow
mihow / load_dotenv.sh
Last active March 6, 2026 10:58
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active March 13, 2026 08:37
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.