Skip to content

Instantly share code, notes, and snippets.

View thamas's full-sized avatar

Tamás Hajas thamas

View GitHub Profile

trzalica [Oct 5th at 12:37 AM] Hi all! I wrote an article about how I use Responsive images in PL/Drupal... Maybe it will be helpful to some of you who are using/planing to use Pattern Lab in your projects. mosaicwebsites.com/blog/responsive-images-emulsify-pl-theme-easy-way

64 replies danny_englander [6 days ago] @trzalica Excellent. So if I understand this correctly, your first block of code (which has things like "responsive_image_base_class": your_component_variable_name_image_base_class,) that defines everything would appear in a Pattern Lab Twig file, say card.twig for example. Then your second block of code i.e. {{ content.field_machine_name_of_responsive_image_field[0] }} would be part of an embed on the Drupal side in a drupal twig template?

@ModulesUnraveled
ModulesUnraveled / 1. flexible-grid.twig
Last active November 13, 2020 02:29
Nested Paragraphs + PL
{#
# This is the PL template for the "parent" pattern
#}
{% set flexible_grid_base_class = flexible_grid_base_class|default('flexible-grid') %}
{% set item_count = flexible_grid_item_count|default(rows|length) %}
{# Dynamically define grid columns #}
{% if item_count is divisible by(3) %}
{% set flexible_grid_modifiers = ["columns-3"] %}
@vladimirsiljkovic
vladimirsiljkovic / select.css
Last active November 26, 2022 09:59
Cross-browser (IE11+) <select> element styling without wrapper <div> https://jsbin.com/diqene/edit?html,css,output
select {
-webkit-appearance: none; /* Webkit */
-moz-appearance: none; /* FF */
-ms-appearance: none; /* Edge */
appearance: none; /* Future */
/* Optional styles */
padding: 0.3em 1.5em 0.3em 0.6em;
border: 1px solid currentColor;
background: white;
@renebakx
renebakx / settings.md
Last active January 23, 2018 09:22
No more drush cr for Drupal 8 theme development

this bit goes in development.services.yml

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
parameters:
  twig.config:
    debug: true
    auto_reload: null
 cache: false
@mortendk
mortendk / snippets.cson
Created October 30, 2015 17:05
atom snippets for drupal twig
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@mortendk
mortendk / template-choser.md
Last active April 29, 2016 09:32
Drupal8 concept for selecting templates form the ui

template chooser

Drupal8 is pretty awesome, but its a problem that you cant choose fromt the ui which template to use. Sure you can overwrite whats there (node--article.html.twig) but that dont give the end user a chance to later change in the site & can end up in even more templates & clutter.

template suggestions

Make it easy to provide a template suggestion for entities, blocks, pages, nodes, fields, menues, username, everything that have a template you should be able to give a suggestion.

class selector

A prepopulated list of classes that can be selected for a template.

The modules userbase is sitebuilders & themes that wants to provide variations for a site, developers dont have to provide templates after a site is build, and can rely on the theme to provide all the variations.

@mortendk
mortendk / twig-loop-template.html.twig
Last active April 29, 2016 09:29
twig loop template
{# loop template #}
{% for item in items %}
{# assing foo, bar or baz to the var foo then print em out #}
{%
set var = [
cycle(["foo", "bar", "baz"], loop.index),
]
%}
{% if loop.first %}
{# first #} {{ var }}
SELECT
id, name
FROM
names
order by
FIELD(
(
CASE 1
WHEN SUBSTRING(BINARY name 1, 3) = 'Dzs'
THEN 'Dzs'
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 18, 2024 03:05
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@joesepi
joesepi / gist:6299513
Last active December 21, 2015 11:29
How to get SublimeLinter working in Sublime Text 3 (ST3)

How to get SublimeLinter working in SublimeText3 (ST3)

This shouldn't be that hard.

I have done a number of things over the last few hours to get this to work and I wasn't taking notes, so this is what I think needs to happen to install SublimeLinter in ST3

The first thing you need to do is uninstall SublimeLinter if you have it installed:

  • Assuming you have Package Controll installed, hit Cmd + Shift + P to bring up the panel and type "remove" and choose "Package Control: Remove Package" and then choose SublimeLinter from the resulting menu

Let's really make sure that all of that SublimeLinter stuff is gone:

  • Navigate to ~/Library/Application\ Support/Sublime\ Text\ 3/