Skip to content

Instantly share code, notes, and snippets.

// Define the text direction on your website
<html lang=”ar-MA” dir=”rtl”>
// Use CSS logical properties
<style>
/* old way */
.absolute-element {
position: absolute;
}
### 1. Find what the drive is called
You'll need to know what the drive is called to mount it. To do that fire off one of the following (ranked in order of my preference):
lsblk
sudo blkid
sudo fdisk -l
You're looking for a partition that should look something like: /dev/sdb1. The more disks you have the higher the letter this is likely to be. Anyway, find it and remember what it's called.
{# https://alextade.me/ #}
{# Drupal Theming - Twig cheat sheet - Useful practical examples twig file. #}
{# Date #}
{% set createdDate = node.getCreatedTime|date('j M Y') %}
<div class="datewrap">{{ createdDate }}</div>
/***
The new CSS reset - version 1.5.1 (last updated 1.3.2022)
GitHub page: https://github.com/elad2412/the-new-css-reset
***/
/*
Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property
- The "symbol *" part is to solve Firefox SVG sprite bug
*/
*:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {
HINTS & SNIPPETS
-----------------
TEMPLATE DEBUGGING OVERWRITING FOR DEV
- twig.config[debug] -> development.services.yml
parameters:
twig.config:
debug: true
auto_reload: true
cache: false
{% if node.field_checkbox['#items'].value == '1' %}
<div class="only added when there are values">
{{ content.field_name }}
</div>
{% endif %}
# get all docker container
docker ps
# access docker container HASH
docker exec -it <mycontainer> bash
# standard call
docker-compose up -d
docker-compose down -v
# how to get the raw field value in a twig template?
{{ entity.field_name.value }} to get the true raw value, includes tags and encoding.
Example: {{ node.body.value }}
result: <p>Batman &amp; Robin</p>
{{ content.field_name.0 }} to get the raw value minus tags and encoding.
Example: {{ content.body.0 }}
# Database
## Export DB
drush cr
drush sql-dump > ~/my-sql-dump-file-name.sql
## Download DB
scp tyler@example.com:~/my-sql-dump-file-name.sql ~/Desktop/
## Import DB