Skip to content

Instantly share code, notes, and snippets.


arshad arshad

View GitHub Profile

Step 1: Add import-glob-loader:

$ npm i import-glob-loader -D

Step 3: Update webpack config:

 | Configuration
arshad / gist:de147c42d7b3063ef7bc
Last active Nov 4, 2020
Convert a Hex string to UIColor in Swift
View gist:de147c42d7b3063ef7bc
// Creates a UIColor from a Hex string.
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(1)
if (countElements(cString) != 6) {
return UIColor.grayColor()
arshad / custom-theme.js
Created Oct 29, 2020
Custom theme for Reflex
View custom-theme.js
import { merge } from "theme-ui"
import base from "@reflexjs/preset-base"
export default merge(base, {
colors: {
text: "#000",
background: "#fff",
primary: "#2a9d8f",
secondary: "#e76f51",
arshad / PurchasedPlanListBuilder.php
Created May 12, 2020
How to override the PurchasedPlanListBuilder for Apigee M10n
View PurchasedPlanListBuilder.php
// Place in `custom_module/src/Entity/ListBuilder/PurchasedPlanListBuilder.php`
namespace Drupal\custom_module\Entity\ListBuilder;
use Drupal\apigee_m10n\Entity\ListBuilder\PurchasedPlanListBuilder as ApigeePurchasedPlanListBuilder;
class PurchasedPlanListBuilder extends ApigeePurchasedPlanListBuilder {
View gatsby-podcast.mdx

Add podcast to your site

This recipe adds podcast support to your Gatsby site using @arshad/gatsby-theme-podcast-core.

Install NPM packages

<NPMPackage name="@arshad/gatsby-theme-podcast-core"

View episodes.js
import React from "react"
import { Link } from "gatsby"
import Image from "gatsby-image"
import Layout from "../../../components/layout"
import SEO from "../../../components/seo"
export const formatDuration = seconds => {
const minutes = Math.floor(seconds / 60)
const hours = Math.floor(seconds / (60 * 60))
arshad / SerializerWithPager.php
Created Dec 20, 2016
A views Serializer plugin for Drupal 8 with pager
View SerializerWithPager.php
namespace Drupal\MODULE_NAME\Plugin\views\style;
use Drupal\rest\Plugin\views\style\Serializer;
* The style plugin for serialized output formats with pager.
* @ingroup views_style_plugins
arshad / create_menu_link.php
Last active Sep 10, 2018
Programmatically create a menu link in Drupal 8
View create_menu_link.php
arshad /
Created Jul 2, 2018
Value module: |pick and |rename_keys example

Value module: |pick and |rename_keys example

Given the following component:

<div class="card">
  <div class="card-header">
    <h4>{{ title }}</h4>
  <div class="card-body">
arshad / ActionsNoDropButton.php
Last active Aug 8, 2017
Add an actions_no_dropbutton Element to render form actions without the dropbutton
View ActionsNoDropButton.php
namespace Drupal\et_article\Element;
use Drupal\Core\Render\Element\Actions;
* Provides a wrapper element to render buttons for a form.
* Usage example:
* @code