Skip to content

Instantly share code, notes, and snippets.


Saurabh Vijayvargiya saurabh-vijayvargiya

  • Websolutions Agency
  • Zagreb, Croatia
View GitHub Profile
saurabh-vijayvargiya /
Created May 13, 2021 — forked from bdlangton/
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');
View 1-highcharts-cheatsheet.js
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download:
// More:
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src=""></script>
// <script src=""></script>
saurabh-vijayvargiya / commerce.php
Created Aug 27, 2019 — forked from St0iK/commerce.php
Useful Drupal Commerce line item wrapper methods & properties
View commerce.php
$wrapper = entity_metadata_wrapper('commerce_order', $order);
// if(isset($wrapper->commerce_customer_shipping->commerce_customer_address)){
// order total object
$order_total = $order_wrapper->commerce_order_total->value();
// subtotal without vat
saurabh-vijayvargiya /
Created Jun 11, 2018 — forked from grenade/
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/mozilla_rsa
saurabh-vijayvargiya / CustomShippingInformation.php
Created Oct 8, 2017 — forked from luksak/CustomShippingInformation.php
Commerce shippping pane that automatically chooses a shipping method without providing a UI for the cutomer
View CustomShippingInformation.php
namespace Drupal\MODULE\Plugin\Commerce\CheckoutPane;
use Drupal\commerce_shipping\Entity\ShipmentInterface;
use Drupal\commerce_shipping\Entity\ShippingMethod;
use Drupal\commerce_shipping\Plugin\Commerce\CheckoutPane\ShippingInformation;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
saurabh-vijayvargiya / drupal8-links.php
Created Sep 5, 2017 — forked from colorfield/drupal8-links.php
Drupal 8 links, or where is my l() function
View drupal8-links.php
name: 'Ajax Example'
description: 'Just an Ajax Example'
core: 8.x
type: module
View Auto Check-In to Southwest Flights.user.js
// ==UserScript==
// @name Auto Check-In to Southwest Flights
// @namespace
// @version 1.5.1
// @author Nicholas Buroojy (
// @contributor Ryan Izzo (
// @contributor JR Hehnly ( @stormchasing)
// @contributor Trevor McClellan (
// @description Automatically check in to Southwest Airline flights at the appropriate time.
// @include*