Linux

Compare 2 files with diff

13 Mar, 2025
This snippet demonstrates how to generate a unified diff (.patch file) between two files using diff -u and apply the patch using patch -p1. This method is useful for tracking changes and updating...
Drupal

Retrieving the Request Path in Drupal 7 Correctly

12 Mar, 2025
In Drupal 7, request_path() is often used to get the request URI. However, this function relies on $_GET['q'], which may not always reflect the actual request URI shown in the browser, especially...

How to Generate Source Maps for Web Builds in Expo

5 Mar, 2025
This snippet shows how to generate source maps for a static web export in Expo. This is useful if you want to self-host your web build or integrate with tools like Sentry for error tracking. There...

Render components based on the platform in React Native

1 Mar, 2025
In Expo, you can conditionally render components based on the platform (web or mobile) using the Platform module from react-native. Here's an example of how to load a component only for web and...

Expo web: Generate .htaccess During Export

1 Mar, 2025
Automatically generate the .htaccess file for you each time you export your Expo web app.

Securely store a JWT token for web and mobile

1 Mar, 2025
This solution is designed specifically for Expo because it uses expo-secure-store. Using SecureStore on mobile and cookies for better security on web.
Drupal

Using ajax_command_invoke in Drupal 7

28 Feb, 2025
ajax_command_invoke is a powerful function in Drupal 7 that allows you to invoke JavaScript methods on DOM elements after an AJAX callback. These code examples will show you through setting up a...
Drupal 9

Drupal Core Development Setup with DDEV

7 Feb, 2025
In this setup, we are creating a Drupal core development environment using DDEV, a Docker-based local development tool. We start by configuring DDEV in a project directory, then clone the official...
PHP

Check for php version compatibility

24 Jan, 2025
PHP
To verify PHP version compatibility in your code, you can use PHP CodeSniffer with the PHPCompatibility ruleset. Ensure that the PHPCompatibility ruleset is installed before proceeding. For instance...
Linux

gpg: keyserver receive failed: No data

24 Jan, 2025
The error gpg: keyserver receive failed: No data occurs when GPG cannot connect to the keyserver to import a key. This is often caused by network issues, a misconfigured GPG keyserver, or a...