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 / gist:b409fd05d86949dcaa3d42b5b5baef65
Created January 20, 2017 05:18
Unix - Get public IP address
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
@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 / 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 / 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 <m@matthieuscarset.com>
*/
@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 / 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 / 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 / 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 / custom_block.module
Created April 6, 2017 18:21
Drupal 7 - Custom Block example
<?php
/**
* Implements hook_block_info().
*/
function custom_block_block_info() {
$blocks = array();
$blocks['states_map'] = array(
'info' => t('States map'),
);
// Get element offset from top of page
function getOffset(el) {
el = el.getBoundingClientRect();
return {
left: el.left + window.scrollX,
top: el.top + window.scrollY
};
};