[Drupal] Create an event subscriber

Instructions I will be creating a dedicated module using Drupal Console for this event subscriber. But feel free to use your own if you already have one! (don’t forget to backup) Access the drupal root folder in command line. Generate a new module:

Generate the event subscriber. We will subscribe to the kernel.request event: […]

[Drupal] Service dependency injection in a service type class

The code

Additional Information Declare the services your class will use in the .services.yml file of your module. Unlike plugin type class service dependency injection, there is no create method to define the needed services. The __construct signature needs to respect the declared arguments from the .services.yml file. Originally made and tested on […]

[Drupal] Service dependency injection in a plugin type class

The code

Additional Information Unlike service type class service dependency injection, there may be no need to implement an interface to be able to load the needed services, such as extending from ControllerBase. So if you are extending from a class which already has the dependency injection implementation, you can just override the create […]

Unity3D.tips[2]: Intersection point between two lines in 2D

The code

The maths behind To get the point where two lines intersect, we will do some maths. To the mathematicians who will come across this post, I’m truly sorry for the heart attacks or strokes you may experience by reading this post. Ok, let’s take a look on the figure: First, sorry, I […]

Unity3D.tips[1]: Strategies to prevent the collision when a ball rolls from a planar surface to another

Method 1: mega box collider Use a single BoxCollider for all your planes. For example, if you have multiple aligned planes, remove their Collider component (Box, Mesh, whichever they have) and on only one of the planes, add a BoxCollider and adjust its center and size values in the component’s inspector to encapsulate all the […]

Petit script VB d’export de table Excel vers .txt

Vous avez besoin d’un petit script en Visual Basic pour faire un export simple d’un tableau Excel vers un fichier texte .txt ? Alors j’ai peut-être le script dont vous avez besoin ! Enthousiasmé Je ne connais pas vraiment VB, mais une lecture rapide de quelques tutoriaux m’a permis de faire ce que je cherchais comme comportement. […]