Skip to content

Instantly share code, notes, and snippets.

Rob Decker robdecker

Block or report user

Report or block robdecker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robdecker
robdecker / 1.md
Last active Mar 20, 2020
[Optional chaining in nested javascript objects] #js
View 1.md
var street = user.address && user.address.street;
var street = user.address?.street;
var street = user.address?.street ?? 'None';
@robdecker
robdecker / 1.js
Created Mar 18, 2020
[Javascript map] #js
View 1.js
const items = [
{
title: 'Item 1'
},
{
title: 'Item 2'
},
{
title: 'Item 3'
},
@robdecker
robdecker / 1.css
Created Feb 25, 2020
[Vertical align image in overflow:hidden div] #css
View 1.css
div {
position: relative;
overflow: hidden;
}
img {
position: absolute;
top: 50%;
transform: translate(0, -50%);
}
@robdecker
robdecker / 1.php
Created Feb 20, 2020
[Add inline JavaScript to a page] #d8 #js
View 1.php
/**
* Implements hook_page_attachments().
*/
function MODULE_NAME_page_attachments(array &$attachments) {
// You can optionally perform a check to make sure you target a specific page.
if (\Drupal::routeMatch()->getRouteName() == 'some.route') {
// Add our JS.
$attachments['#attached']['html_head'][] = [
[
'#tag' => 'script',
@robdecker
robdecker / 1.md
Last active Feb 19, 2020
[Delete lines from file] #sh
View 1.md
@robdecker
robdecker / export_vscode_extesions.md
Last active Jan 28, 2020 — forked from joseluisq/export_vscode_extesions.md
[How to export your VS Code extensions from terminal] #macos
View export_vscode_extesions.md

How to export your VS Code extensions from terminal

Note: Unix-like systems only.

  1. Export your extensions to a shell file:
code --list-extensions | sed -e 's/^/code --install-extension /' > my_vscode_extensions.sh
You can’t perform that action at this time.