Skip to content

Instantly share code, notes, and snippets.

View danny-englander's full-sized avatar

Danny Englander (he/him) danny-englander

View GitHub Profile
@franxo
franxo / .lando.yml
Created June 9, 2023 08:10
Lando file for angular app + storybook
#Lando file for angular app + storybook
name: angular-app
excludes:
- ./node_modules
proxy:
front:
- angular-app.lndo.site:4200
- storybook-app.lndo.site:6006
services:
front:
@miloskroulik
miloskroulik / xdebug_lando_phpstorm.md
Last active March 29, 2024 15:02
How to setup xdebug + Lando + PHPstorm when using Drupal 8 recipe

I assume you're using Drupal 8 recipe and Linux as a host OS. Also, xdebug 3.x is assumed, which is standard for Lando-provided PHP image.

Set up Lando

Example .lando.yml file can look like this:

name: xdebug-test
recipe: drupal8
config:
 webroot: web
@vkechagias
vkechagias / hook.theme.php
Created October 21, 2019 12:32
Drupal 8 get page title from route and set this to page_title block
function HOOK_preprocess_block__page_title_block(&$variables) {
$request = \Drupal::request();
$route_match = \Drupal::routeMatch();
$page_title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
if (!empty($page_title) && empty($variables['content']['#title'])) {
$variables['content']['#title'] = $page_title;
}
}
@thejimbirch
thejimbirch / metatag_example.php
Created August 19, 2019 20:27 — forked from mortenson/metatag_example.php
OR statements in metatags...
<?php
/**
* Implements hook_metatags_attachments_alter().
*
* This function allows you to define fallback tokens in case a field is empty.
*
* If all fallback values are empty, the tag will be empty.
*
* Example: [node:field_image:medium]||[node:field_legacy_image:medium]||/fallback.png
@leymannx
leymannx / gulpfile.js
Last active December 7, 2022 10:57
Gulp 4 Sass BrowserSync Kickstart Example
// Requires Gulp v4.
// $ npm uninstall --global gulp gulp-cli
// $ rm /usr/local/share/man/man1/gulp.1
// $ npm install --global gulp-cli
// $ npm install
const { src, dest, watch, series, parallel } = require('gulp');
const browsersync = require('browser-sync').create();
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
@thamas
thamas / field--field-unit-plural.html.twig
Last active December 11, 2018 14:30
Drupal 8 Twig: hide a (paragraph) field based on the value of a sibling field
{#
This snippet is from a component based (Emulsify / Pattern Lab) custom Drupal theme.
The "span_…" variables are the properties of the BEM Twig function.
See: https://www.fourkitchens.com/blog/development/bem-twig-function/
The goal is to set the default display correctly (when the page loads).
After that the field visibility is manipulated by JS based on user interaction.
#}
{% set amount = element['#object'].field_amount.value %}
@iamrobert
iamrobert / tiny-slider-app.js
Created October 3, 2018 06:04
Tiny Slider - with plyr.io video stop
app.pageSliders = {
slider: null,
container: ".tiny-slider",
init: function() {
// no reason to continue init if no slider on page
if (!document.querySelector("#mainslider")) {
return;
}
app.pageSliders.slider = tns({
@shadcn
shadcn / Value.md
Created July 2, 2018 12:58
Value module: |pick and |rename_keys example

Value module: |pick and |rename_keys example

Given the following component:

<div class="card">
  <div class="card-header">
    <h4>{{ title }}</h4>
  </div>
  <div class="card-body">
@illepic
illepic / particle-deps.sh
Last active May 18, 2022 21:50
Particle from scratch with all dependencies
#!/usr/bin/env bash
# 1. Skip steps if you already have the tools listed
# 2. Run source ~/.bashrc or source ~/.zshrc after each step to ensure command is registered
# Install Homebrew, if not installed
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update Homebrew installed packages
brew update && brew upgrade
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");