LC

Knowledge Base

Snippets

Reusable code snippets — copy-paste ready.

20 snippets
twig

Drupal Twig Field Rendering Patterns

Common patterns for rendering field values in Drupal 8+ Twig templates.

drupaltwigthemingfields
bash

Drupal Drush Quick Reference

Essential Drush commands for Drupal development and operations.

drupaldrushcli
javascript

Hex to RGB Conversion

Convert hex color codes to RGB values in JavaScript.

colorscssconversion
javascript

Extract YouTube & Vimeo Video IDs

Parse video IDs from YouTube and Vimeo URLs and generate embed URLs.

videoyoutubevimeoregex
bash

Patch npm Packages with patch-package

Apply fixes to node_modules packages that persist across installs.

npmpatchnodedependencies
python

Python Read CSV with Arabic Date Translation

Read CSV files with pandas and parse Arabic dates using dateparser.

pythonpandascsvi18ndates
php

Drupal Create Links Programmatically

Create various types of links in Drupal 8 using URL and Link classes.

drupallinksroutingtheming
php

WordPress Enqueue Scripts & Styles

Properly enqueue external and theme scripts/styles in WordPress.

wordpressenqueueajaxscripts
php

WordPress Admin Customization Snippets

Hide admin menus, remove category prefix, and hide reCAPTCHA badge.

wordpressadmincustomization
bash

Node.js EACCES Permission Fix (Windows)

Fix 'Error: listen EACCES: permission denied' on Windows by resetting WinNAT.

nodewindowsnetworkingtroubleshooting
php

WordPress Custom Post Type Taxonomy

Get taxonomy terms for custom post types in WordPress.

wordpresscustom-post-typetaxonomy
php

WordPress Polylang Language Switcher Shortcode

Create a custom language switcher shortcode with flags for Polylang.

wordpresspolylangi18nshortcode
php

WordPress ACF Meta Query for Checkbox Fields

Query posts by ACF checkbox field values using WP_Query meta_query.

wordpressacfwp-querymeta-query
text

Cloudflare WAF Rule for WordPress

Protect WordPress admin and login pages with Cloudflare WAF custom rules.

cloudflarewafwordpresssecurity
css

CSS Sticky Footer

Keep the footer at the bottom of the page with minimal CSS.

csslayoutfooter
php

WordPress Cookie Bar Conditional Display

Hide GDPR cookie consent bar on specific pages using wildcard matching.

wordpressgdprcookiesconditional
bash

Composer Memory Limit Fix

Fix 'Allowed memory size exhausted' error when running Composer.

composerphpmemorytroubleshooting
bash

Git User Configuration Per Repository

Set different Git identities for different repositories.

gitconfigidentity
bash

Yarn Network Timeout Fix

Increase Yarn's network timeout for slow connections.

yarnnpmnetworkingtroubleshooting
html

HTML Custom 404 Page

A clean, minimal 404 error page with centered layout.

htmlcsserror-page