Skip to content

Instantly share code, notes, and snippets.

View mohammadanwar's full-sized avatar
☁️

Mohammad Anwar Siddiqui mohammadanwar

☁️
View GitHub Profile
@mohammadanwar
mohammadanwar / .lando.yml
Created July 28, 2022 07:41
Lando with Apple M1 Chip and Moneterey MacOS
name: drupal9
recipe: drupal9
config:
php: '8.1'
via: apache:2.4
webroot: web
drush: 9
database: mariadb:10.6.5
xdebug: true
proxy:
@mohammadanwar
mohammadanwar / Set_up_a_new_mac.txt
Created August 28, 2024 05:19 — forked from davidjguru/Set_up_a_new_mac.txt
Stuff I use to install if I setup a new mac
- Change the root password!
- System Settings > Security
- General: Set Password required to "instant"
- FileVault: activate
- System Setting > Keyboard
- Set all key speeds to "fast"
- Mark checkbox to use "fn" keys without option key
- Generate SSH-Key: ssh-keygen -t rsa -C "email@provider.com" -b 2048
- Change desktop background :)
- Install PHPstorm + Java
@mohammadanwar
mohammadanwar / MyCustomForm.php
Created August 28, 2024 05:20 — forked from davidjguru/MyCustomForm.php
Drupal - Autosubmit exposed form in JS
<?php
namespace Drupal\mymodule\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a custom form.
*/

Introduction

Github CLI is a console tool for working on interactions with Github from terminal. This tool allow to add new extension by developing them and adding to the main gh prompt as sub-commands from your command line. Read More about how to implement custom Github CLI extensions.

For this example we use a private extension not available for public purposes but you can explore some others existing Github CLI extensions. See the list of available extensions at https://github.com/topics/gh-extension.

In order to follow the next steps just change [RESOURCE] by your marked extension.

Install Github CLI in Ubuntu / Debian

Add repository

@mohammadanwar
mohammadanwar / Drupal Multisite Drush Script
Created August 28, 2024 05:21 — forked from davidjguru/Drupal Multisite Drush Script
If you're running multiple sites on one drupal installation, here is a script to run different Drush commands on all of them
#!/bin/bash
# Get all Drupal sites
sites=`find . -maxdepth 1 -type d -print | grep -v '/all$' | grep -v '/default$' | grep -v '\.$'`
echo "Choose the commande to execute : "
echo "1. update"
echo "2. put sites offline"
echo "3. put sites online"
echo "4. clear all cache"
@mohammadanwar
mohammadanwar / top_ten_frequent_operations_developing_with_drupal.md
Created August 28, 2024 05:21 — forked from davidjguru/top_ten_frequent_operations_developing_with_drupal.md
List of top ten most frequent operations developing with Drupal.

1. Getting config values from the system

1.1 Getting config values from a hook

$slogan = \Drupal::config('system.site')->get('slogan');

1.2 Getting config values from a preprocess function of a template file

e.g. => mytheme_preprocess_node(&$variables))

@mohammadanwar
mohammadanwar / my_favourite_git_aliases_for_prompt.md
Created August 28, 2024 05:21 — forked from davidjguru/my_favourite_git_aliases_for_prompt.md
Gathering my favourite git aliases (from the Linux OS level, not like Git aliases).

Git Related Aliases

Getting basic info of the situation of your project: status, branches, current branch, naming of remote repo.

alias gs='git status'
alias gb='git branch'
alias gr='git remote -v'
alias gp='git rev-parse --abbrev-ref HEAD'

Getting info from 'Git log' about last commits, last changed files in 12 months by order and by commit message.

@mohammadanwar
mohammadanwar / git_getting_all_remote_branches_updated_in_local_environment.md How to get all the code from remote repository from all the available remote branches.
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all