Skip to content

Instantly share code, notes, and snippets.

View reddyweb's full-sized avatar
🎯
Focusing

Sudharshan reddyweb

🎯
Focusing
View GitHub Profile
@RowboTony
RowboTony / delete_filter_format.drush.php
Created November 17, 2023 04:37
Drush scripts to clean up database issues for Drupal 7 migrations
<?php
/**
* Drush script to delete a text format (filter format) from the Drupal 7 database.
*
* Usage:
* drush scr path/to/delete_filter_format.drush.php --filter_format=filtered_html [--dry-run]
*/
// Drush bootstrap for full Drupal access.
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
@reddyweb
reddyweb / node.html.twig
Last active November 28, 2021 14:03
Drupal 9 Twig - Field Image Multivalue field with title and alt tags
{% for key, item in node.field_image.value %}
<img src="{{ file_url(content.field_image[key]['#item'].entity.uri.value) }}" alt="{{ item.alt }}" title="{{ item.title }}" />
{# or #}
{{ content.field_image[key] }}
{% endfor %}
@bradtraversy
bradtraversy / mysql_cheat_sheet.md
Last active October 26, 2025 07:09
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@heathdutton
heathdutton / upgrade-php7.sh
Last active January 12, 2024 07:47
Upgrade PHP to 7.3 on Amazon Linux (specifically for Elastic Beanstalk but should work elsewhere)
#!/usr/bin/env bash
# Upgrade an Amazon Linux EC2 to PHP 7.3
#
# Last tested w/ PHP 7.2 AWS Linux version 2.8.5
#
# Must be ran as sudo:
# sudo bash upgrade-php7.sh
#
# Can be added to ./.ebextensions/20_php.config like so:
# container_commands:
@Auke1810
Auke1810 / wpa-clean-header.php
Last active February 25, 2025 22:05
create a clean wordpress header and remove unnecessary clutter.
<?php
/*
Plugin Name: wordpress assist clean header
Plugin URI: http://www.wordpressassist.nl/
Description: Remove shortlink hook
Version: 1.0
Author: AukeJomm
Author URI: http://www.aukejongbloed.nl
*/
@mortenson
mortenson / composer.json
Last active August 20, 2023 10:39
Example composer.json file for File Browser
{
"name": "mortenson/example",
"minimum-stability": "dev",
"authors": [
{
"name": "Samuel Mortenson",
"email": "samuel.mortenson@acquia.com"
}
],
"repositories": [
@Iman
Iman / clean.sh
Last active October 23, 2025 17:36
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/usr/bin/env bash
# Ubuntu Server or VM Cleaner. Safe by default; aggressive when asked.
# Example safe: sudo ./clean.sh
# Example aggressive: sudo JOURNAL_DAYS=3 AGGRESSIVE=1 ./clean.sh
# Enable Docker image prune (images only): sudo ./clean.sh --docker-images
# Tested on Ubuntu 20.04, 22.04, 24.04 (server/VM images).
set -Eeuo pipefail
trap 'rc=$?; echo "Error on line $LINENO: $BASH_COMMAND (exit $rc)"; exit $rc' ERR
IFS=$'\n\t'
@webchick
webchick / drupal-hooks-by-implementation
Last active April 9, 2020 10:00
A list of hooks in all* Drupal contrib modules (6.x and 7.x), in descending order of how often they're implemented. (Consolidated a few that were renamed between 6 and 7) * Within a rounding error. :P
Array
(
[hook_menu] => 6744
[hook_uninstall] => 4742
[hook_perm(ission)] => 4012
[hook_install] => 3751
[hook_theme] => 3525
[hook_schema] => 3003
[hook_help] => 2465
[hook_form_alter] => 2273