Skip to content

Instantly share code, notes, and snippets.

View normanlolx's full-sized avatar
✍️
git reset --soft HEAD~1

Norman normanlolx

✍️
git reset --soft HEAD~1
View GitHub Profile
@crittermike
crittermike / import.php
Last active April 15, 2025 18:49
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
@joyrexus
joyrexus / README.md
Last active December 30, 2024 01:37
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@jbutko
jbutko / readme.MD
Last active June 24, 2022 10:51
Add deploy keys to gitlab project
@Majkl578
Majkl578 / Dockerfile
Last active November 8, 2019 17:41
Dockerized example for article at Pehapkari.cz about running multiple PHP versions: https://pehapkari.cz/blog/2017/03/27/multiple-php-versions-the-easy-way/
FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
# install NGINX
RUN apt-get update && \
apt-get install -y nginx --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
@7rin0
7rin0 / gist:ea890d2d4bf25a890b86aff01290e7d0
Created March 3, 2017 01:52
Docker exec root or default user
# Root.
$ docker exec -u 0 i -t {container_id/image_name} bash
or
# Default container's user.
$ docker exec i -t {container_id/image_name} bash
@JeffTomlinson
JeffTomlinson / MyService.php
Last active August 7, 2024 11:28
Drupal 8 Configuration Dependency Injection
<?php
namespace Drupal\my_module\Services;
use Drupal\Core\Config\ConfigFactory;
/**
* Class MyService.
*
* @package Drupal\my_module\Services
<?php
namespace Drupal\batch_example;
use Drupal\node\Entity\Node;
class DeleteNode {
public static function deleteNodeExample($nids, &$context){
<?php
namespace Drupal\batch_example\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class DeleteNodeForm.
*
batch_example.delete_node_example:
path: '/batch-example/delete'
defaults:
_form: '\Drupal\batch_example\Form\DeleteNodeForm'
_title: 'Batch Example'
requirements:
_permission: 'access content'
name: batch_example
type: module
description: Example module for batch process
core: 8.x
package: Example