Skip to content

Instantly share code, notes, and snippets.

@shadcn
shadcn / ActionsNoDropButton.php
Last active August 8, 2017 09:01
Add an actions_no_dropbutton Element to render form actions without the dropbutton
<?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
@shadcn
shadcn / settings.local.php
Created December 14, 2016 08:23
Example settings.local.php
<?php
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
* 'sites/default/settings.php' and uncomment the commented lines that mention
* 'settings.local.php'.
@shadcn
shadcn / local.services.yml
Created December 14, 2016 08:24
Example local.services.yml
# Local development services.
#
# To activate this feature, follow the instructions at the top of the
# 'example.settings.local.php' file, which sits next to this file.
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
parameters:
twig.config:
debug: true
@shadcn
shadcn / SerializerWithPager.php
Created December 20, 2016 06:53
A views Serializer plugin for Drupal 8 with pager
<?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
@shadcn
shadcn / PANTHEON.md
Last active February 23, 2017 18:38
How to create a composer-based project on Pantheon.

How to create a composer-based project on Pantheon.

  1. Install Terminus: composer global require pantheon-systems/terminus.
  2. Head to your Pantheon dashboard, go to your Account and click on Machine Tokens.
  3. Create a new token and use it auth with Pantheon: terminus auth:login --machine-token=MACHINE-TOKEN
  4. Create a new site on Pantheon using terminus: terminus site:create name-of-site "Name of Site" 35b0e365-a191-4c70-adbe-9d02d01343f3. 35b0e365-a191-4c70-adbe-9d02d01343f3 is the uuid of the Drops 8 Composer upstream. You can see a list of upstream by running terminus upstream:list
  5. Once the site is created, you can head to http://dev-name-of-site.pantheonsite.io and continue with setup.
  6. Cloning your site on your local should give you a composer-based template.
@shadcn
shadcn / README.md
Last active January 20, 2025 10:54
How to add custom fonts to a Radix theme

1. Google Fonts

  1. Copy the @import url from https://fonts.google.com.
  2. Edit /scss/base/_variables.scss and add your @import url under // Typography.
  3. Update the $font-family variables.

Example:

// Typography
@shadcn
shadcn / Value.md
Created July 2, 2018 12:58
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>
  <div class="card-body">
@shadcn
shadcn / glob-for-radix.md
Created November 12, 2019 08:42
Glob for Radix

Step 1: Add import-glob-loader:

$ npm i import-glob-loader -D

Step 3: Update webpack config:

/*
 |--------------------------------------------------------------------------
 | Configuration
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))

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"