Skip to content

Instantly share code, notes, and snippets.

View scodx's full-sized avatar
🏠
Working from home

Oscar Sánchez scodx

🏠
Working from home
View GitHub Profile
@scodx
scodx / untrack.md
Created June 6, 2020 00:11
Untrack files already added to .gitignore
  • edit your .gitignore file
  • git rm -r --cached [PATH], whre [PATH] is the path for the new ignored files
  • git add . or corresponding files
  • git commit - '.gitignore fix'
@scodx
scodx / drupal_8_twig_cheatsheet.md
Created May 31, 2020 23:58 — forked from raphaellarrinaga/drupal_8_twig_cheatsheet.md
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

Image title text: {{ node.field_name.title }}

Entity Reference path: {{ content.field_tags[0]['#url'] }}

@scodx
scodx / drupal_8_php_cheat.md
Created May 31, 2020 23:58 — forked from raphaellarrinaga/drupal_8_php_cheat.md
[Drupal 8 php/config cheatsheet] #tags: drupal8, php, config, cheatsheet

Drupal 8 PHP cheatsheet

Get current node id

$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
  $nid = $node->id();
}
/* optional */
/* uppercase titles */
.page-content h1{text-transform:uppercase}
h1.break-text{text-transform:uppercase}
/* Dracula stuff */
/* background */
:focus{outline-style:none!important}
html {background-color: #282b36;}
@scodx
scodx / config.yml
Last active April 16, 2022 14:58
traefik example with letsencrypt and docker and external services
# place this file in the `config` folder
http:
services:
# the urls must be accesible from the traefik installation, either native or as a container
rundeck:
loadBalancer:
servers:
- url: http://172.17.0.1:4440
php-tt:
@scodx
scodx / macos-flush-dns-cache.md
Created December 6, 2019 15:28
MacOS flush dns cache
$ dscacheutil -flushcache
$ sudo killall -HUP mDNSResponder
@scodx
scodx / mysql_root_password.md
Last active September 2, 2019 17:15
MySQL root password not working

MySQL or Mariadb Root password not working

After installing mysql/mariadb the root password is not working, even after executing the secure_installation script. I followed these steps on a Ubuntu server 18.08 and seems to work there.

sudo su
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -uroot
@scodx
scodx / mariadb-brew.md
Last active August 23, 2019 02:52
MariaDB not starting on macOS after brew install/update/prune or macOS upgrade FIX

Issue

After a brew install, update, prune or some other operation like upgrading macOS, MariaDB is not starting and after looking at its logs I see something like:

mariadb: missing /usr/local/etc/my.cnf.d

A quick fix is to create the directory: mkdir /usr/local/etc/my.cnf.d, but be aware that this will happen again. I haven't found any fix on this.

Note