Skip to content

Instantly share code, notes, and snippets.

View davidjguru's full-sized avatar
🍅
Working within a pomodoro cycle

David Rodriguez davidjguru

🍅
Working within a pomodoro cycle
View GitHub Profile
@davidjguru
davidjguru / bash-colors.md
Created July 18, 2024 08:06 — forked from JBlond/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@davidjguru
davidjguru / Set_up_a_new_mac.txt
Created April 11, 2024 14:02 — forked from tomraithel/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
@davidjguru
davidjguru / MyCustomForm.php
Created May 19, 2023 08:22 — forked from MatthieuScarset/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.
*/
@davidjguru
davidjguru / working_with_github_cli_and_derivative_extensions.md
Last active April 25, 2023 16:24
Working with Github CLI and derivative extensions

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

@davidjguru
davidjguru / Drupal Multisite Drush Script
Created October 3, 2022 09:49 — forked from gueno/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"
@davidjguru
davidjguru / top_ten_frequent_operations_developing_with_drupal.md
Last active September 28, 2022 08:00
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))

@davidjguru
davidjguru / my_favourite_git_aliases_for_prompt.md
Created March 31, 2022 09:22
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.

@davidjguru
davidjguru / git_getting_all_remote_branches_updated_in_local_environment.md
Created March 30, 2022 11:30
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
@davidjguru
davidjguru / _intro_drupal_8_9_getting_data_from_user_account.md
Last active February 17, 2022 20:15
Drupal 8 || 9 - Getting data from user account in Drupal