Skip to content

Instantly share code, notes, and snippets.

View robdecker's full-sized avatar

Rob Decker robdecker

View GitHub Profile
@robdecker
robdecker / 1.twig
Created May 18, 2020 18:46
[Tiles with bottom borders of varying number of columns] #d8 #twig
{% set quantity = tiles|length %}
{% set attributes = {
class: [
'tiles'
],
'data-quantity': quantity,
'data-layout': num_cols,
'data-modulo-2': quantity % 2,
'data-modulo-3': quantity % 3,
'data-modulo-4': quantity % 4,
@robdecker
robdecker / 1.md
Created May 14, 2020 20:53
[VS Code tips] #macos

Explorer keyboard navigation

Command: list.toggleKeyboardNavigation

@robdecker
robdecker / youtube_id_regex.php
Created May 7, 2020 20:56 — forked from ghalusa/youtube_id_regex.php
[Extract the YouTube Video ID from a URL in PHP] #php
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@robdecker
robdecker / php-get-vimeo-video-id-from-url.php
Last active May 7, 2020 20:58 — forked from anjan011/php-get-vimeo-video-id-from-url.php
[Get Vimeo Video ID from URL in PHP] #php
<?php
/**
* Get Vimeo video id from url
*
* Supported url formats -
*
* https://vimeo.com/11111111
* http://vimeo.com/11111111
@robdecker
robdecker / 1.md
Created May 1, 2020 20:04
[What's running on a port] #macos #sh
@robdecker
robdecker / 1.md
Created May 1, 2020 17:37
[Show/hide hidden files in Finder] #macos
command + shift + . (dot/period)
@robdecker
robdecker / 1.md
Last active April 28, 2020 22:54
[Views content is duplicated if translated] #d8

On a multilingual site, if content is translated, all translations of the node are often included in views results

What we want:

  • No duplicates
  • Show the translated node, if the translation exists
  • If no translation exists, show the node in its original language

The fix requires a combination of two things:

@robdecker
robdecker / 1.md
Created April 23, 2020 20:45
[Find command] #sh

Find all folders (starting in the current folder) based on a partial folder name

find . -type d -name "*searchname*"