Skip to content

Instantly share code, notes, and snippets.

View deepakaryan1988's full-sized avatar
🏠
Working from home

Deepak Kumar deepakaryan1988

🏠
Working from home
View GitHub Profile
1. Enable virtualisation from BIOS setting
2. Install docker desktop
3. Disable WSL2 and share your drive or folder from docker setting
4. Enable Hyper-v from windows setting
5. copy all the files docker4drupal to your drupal folder(most probably outside your web)
6. comment mariadb syntax from docker-composer.yml
7. Install mariadb on your windows separately.
8. run docker-compose up -d
9. put your URL in hosts file
10. change the mysql host entry(host.docker.internal) in your settings.php
@deepakaryan1988
deepakaryan1988 / flow.json
Created December 9, 2020 06:00 — forked from drobiazko/flow.json
MongoDb Find Demo
{
"nodes": [
{
"title": "Code",
"icon": "images/icons/code_64.png",
"top": 165,
"left": 372,
"compID": "code",
"code": "next(null, { message : \"How does it work?\" });",
"id": "step_125"
@deepakaryan1988
deepakaryan1988 / deletemanyMongodb
Created December 9, 2020 05:59
Deletemany mongodb
$collection = 'post';
$uid = '482';
$database = \Drupal::service('mongodb.database_factory')->get('default');
$collection = $database->selectCollection($collection);
$selector = ['user_id.target_id' => (int) $uid];
$deleteResult = $collection->deleteMany($selector);
kint($deleteResult->getDeletedCount());
kint($deleteResult);exit;
@deepakaryan1988
deepakaryan1988 / gist:75bf92ed053f21c7d3e9be31baa15c44
Created July 31, 2020 05:08
D8-getting current moderation state
use Drupal\grievance\Entity\GrievanceEntity;
$grievance_id = "4";
$grievance = GrievanceEntity::load($grievance_id);
$grievance_vid = \Drupal::entityManager()->getStorage('grievance')->revisionIds($grievance);
$latest_revision_id = array_pop((array_slice($grievance_vid, -1)));
$grievance_revision = \Drupal::entityTypeManager()
->getStorage('grievance')
->loadRevision($latest_revision_id);
$current_state = $grievance_revision->get('moderation_state')->getValue()['0']['value'];
kint($current_state);exit;
@deepakaryan1988
deepakaryan1988 / hook_update_N.php
Created July 28, 2020 08:27 — forked from sumanthkumarc/hook_update_N.php
Drupal 8: Create a new table in database using hook_update_N()
<?php
/**
*The numbers are normally composed of three parts:
* - 1 or 2 digits for Drupal core compatibility (Drupal 8, 9, 10, etc.). This
* convention must be followed.
* - 1 digit for your module's major release version; for example, for 8.x-1.*
* use 1, for 8.x-2.* use 2, for Core 8.0.x use 0, and for Core 8.1.x use 1.
* This convention is optional but suggested for clarity.
# Migration configuration for imported planets.
id: import_drupal_planets
label: Import planets Data from Nasa
migration_group: Drupal Import
dependencies:
enforced:
module:
- nasa_facts
destination:
@deepakaryan1988
deepakaryan1988 / drupalvm-config.yml
Created June 4, 2019 10:14
Used for latest drupalvm config
---
# Available `vagrant_box` values include:
# - beet/box (pre-provisioned, based on Ubuntu 16.04)
# - geerlingguy/drupal-vm (pre-provisioned, based on Ubuntu 16.04)
# - geerlingguy/centos7
# - geerlingguy/centos6
# - geerlingguy/debian9
# - geerlingguy/debian8
# - geerlingguy/ubuntu1804
# - geerlingguy/ubuntu1604
{
"type": "project",
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"asset-packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
Ref:- https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04
1. PHP packages install:-
a. php-gd
b. php-cli
c. php-curl
d. php-ldap
e. php-zip
f. php-mail
g. php-mail-mime
@deepakaryan1988
deepakaryan1988 / drupal_phpcs_install.sh
Created November 10, 2017 11:07
Install PHPCS and use the Drupal Coding Standard from the coder module.
; cd into the directory you store code resources.
cd ~
; Clone PHP_CodeSniffer directly from the github repo.
; You could also install via pear.
git clone [email protected]:squizlabs/PHP_CodeSniffer.git
; Clone the coder branch you want.