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 / 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 / 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 / Blocks.md
Created November 12, 2020 17:47 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@davidjguru
davidjguru / gist:126aa9f2a1ada52ac49fa500181fd82c
Created May 25, 2020 18:14 — forked from rajeshpv/gist:6356679
Install Balsamiq for ubuntu
helpfull links
(1) https://gist.github.com/cbednarski/5379830
(2) http://www.clarifylinux.org/2012/04/ubuntu-1204-tweak-and-hack-round-up.html
(3) http://jeffhendricks.net/?p=68
(4) BEST for 64 bit http://www.randomhacks.co.uk/how-to-install-balsamiq-mockups-on-ubuntu-13-10/
The steps I did
RUN>>
locate libgnome-keyring.so /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0
@davidjguru
davidjguru / __INDEX.txt
Created May 15, 2020 09:50 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@davidjguru
davidjguru / settings.local.php
Created January 16, 2020 11:51 — forked from keopx/settings.local.php
Drupal 8 Redis settings.local.php
<?php
/**
* Set redis configuration.
*/
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
// $settings['cache']['default'] = 'cache.backend.redis';
@davidjguru
davidjguru / MyService.php
Created October 26, 2019 19:29 — forked from JeffTomlinson/MyService.php
Drupal 8 Configuration Dependency Injection
<?php
namespace Drupal\my_module\Services;
use Drupal\Core\Config\ConfigFactory;
/**
* Class MyService.
*
* @package Drupal\my_module\Services
@davidjguru
davidjguru / Table.php
Created December 6, 2018 23:51 — forked from chx/Table.php
Plain table migration source plugin
<?php
namespace Drupal\sd8_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Table source from database.
*