Skip to content

Instantly share code, notes, and snippets.

View deepakaryan1988's full-sized avatar
🎯
Focusing

Deepak Kumar deepakaryan1988

🎯
Focusing
View GitHub Profile
@deepakaryan1988
deepakaryan1988 / customslider
Last active July 25, 2017 05:15
Custom slider with custom values
https://jsfiddle.net/2sxugxgd/3/
@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 git@github.com:squizlabs/PHP_CodeSniffer.git
; Clone the coder branch you want.
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
{
"type": "project",
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"asset-packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
@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
# 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 / 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.
@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 / 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 / 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"