Code Snippets

This is a portfolio of code snippets from projects I've worked on over the years using the following technologies: Drupal, Sass, Gulp, Git, jQuery, Docksal, and more.

Since most of my full time coding work over the past 5 years has dealt with Enterprise level private repositories, I decided to create this site as a showcase for some code snippets, examples, and experiments I've worked on over the years. This is a work in progress, so I'll be adding more code over time.

  • d7

    Drupal 7: Attach JS With Conditions

    Attach fitvids.js to a wysiwyg field where a video is present via the video filter module.

  • jQ

    Setting a Color theme with jQuery Cookie

    This code allows a user to select a color theme from a slide out panel in a Drupal theme

  • Th

    Lazy Load Responsive Images using LazySizes JS

    A Jekyll loop that draws upon YAML data for responsive images

  • d8

    Drupal 8: Set a Conditional class for Edge to Edge content types

    Get an array of node types and then add a body class

  • Tw

    Drupal 8: Create a Twig Template Theme Hook

    Create Twig template theme hook suggestions for Drupal user view modes

  • d8

    Drupal 8: Theming a File Link by Content Type

    Using Drupal 8's theme_suggestions_later hook for enhanced Twig template variations

  • d8

    Drupal 8: Removing Core Stylesheets in a Sub-theme

    Using Drupal 8's libraries-override function

  • d7

    Drupal 7 Theming: Adding a Views Name as a Body Class

    In which we query with Drupal's global views_get_page_view function

  • dK

    Custom Install Script With Docksal

    A custom script to install Node, Yarn, Jekyll, and Ruby in Docksal

  • Sa

    Sass Loops for Creating Custom Utility Classes

    Create CSS utility classes the easy way using a Sass @each loop