Skip to content

Instantly share code, notes, and snippets.

View MatthieuScarset's full-sized avatar
🤷‍♂️
Probably me

MattGyver MatthieuScarset

🤷‍♂️
Probably me
View GitHub Profile
@MatthieuScarset
MatthieuScarset / d7-add-entity-view-mode.md
Created April 5, 2017 20:10 — forked from swichers/d7-add-entity-view-mode.md
Drupal 7 - Programmatically add view mode to entity

In a module file:

This will enable an additional view mode for use on the specified entity type(s). Many examples will show the custom settings here being set to TRUE. If TRUE is used then that view mode is added to all entities of the specified type regardless of if it should be on the bundle or not.

/**
 * Implements hook_entity_info_alter().
 */
function HOOK_entity_info_alter(&$entity_info) {
@MatthieuScarset
MatthieuScarset / docker4drupal-fixpermission
Created April 5, 2017 17:06
Fix permission to export Feature updates in docker4drupal
docker exec -t -i [php_container] bash
chown -R www-data:www-data [drupal_root]
@MatthieuScarset
MatthieuScarset / .bashrc
Created April 5, 2017 11:08
My custom .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@MatthieuScarset
MatthieuScarset / grid.css
Created March 19, 2017 16:28
CSS3 - Easy pleasy Flexbox grid
/**
* Grid based on flexbox
*
* CSS3 variables:
* --flex-basis: 10%;
* --flex-padding: 0.5em;
*
* @author Matthieu SCARSET <[email protected]>
*/
@MatthieuScarset
MatthieuScarset / keybindings.json
Last active March 6, 2024 09:28
VSCode keybinding
[
{
// Open/close integrated terminal.
"key": "ctrl+shift+'",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"key": "ctrl+shift+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus"
@MatthieuScarset
MatthieuScarset / settings.json
Last active September 18, 2023 04:05
VSCode settings
{
// Tracking shit.
"telemetry.telemetryLevel": "off",
"enableTelemetry": false,
"hardhat.telemetry": false,
"redhat.telemetry.enabled": false,
"gitlens.advanced.telemetry.enabled": false,
// Global
"debug.toolBarLocation": "docked",
"debug.allowBreakpointsEverywhere": true,
@MatthieuScarset
MatthieuScarset / gist:b409fd05d86949dcaa3d42b5b5baef65
Created January 20, 2017 05:18
Unix - Get public IP address
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
$form_state->getFormObject()->getEntity();
@MatthieuScarset
MatthieuScarset / .bash_aliases
Last active March 20, 2017 08:12
My custom bash aliases
# Rexecute last cmd as root
alias fuck='sudo $(history -p \!\!)'
# Folders related aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Typo (because I type quick and dirty...)
alias cc='clear'
@MatthieuScarset
MatthieuScarset / gist:47b57f2e3bd4afee39a81ae5a7c3dc28
Created December 27, 2016 14:14
Drupal 8 - Get canonical node URL in TWIG
{{ path('entity.node.canonical', {'node': node.id }) }}