Skip to content

Instantly share code, notes, and snippets.

View isramv's full-sized avatar
🐧

Israel M isramv

🐧
View GitHub Profile
@leahtard
leahtard / node.twig.html
Last active June 9, 2022 18:32
Get file url in node for Drupal 8 twig template
{# Get URL of single file field #}
{{ node.field_file.entity.uri.value }}
{# Get URL of multi file field #}
{{ node.field_file['#items'].entity.uri.value }}
{# Trun into link #}
{{ file_url(node.field_file.entity.uri.value) }}
{# Check if there is at least one value #}
@paulstatezny
paulstatezny / commit.fish
Last active June 15, 2018 21:45
A fish shell function for committing in Git in a "Refs #123 - Commit message." format (Usage: `commit 'Commit message'`)
# Prefix commit message with "Refs #[PULL_NUMBER] - "
# PULL_NUMBER is derived from the branch name, which is assumed to be in one of the following formats:
# something/[PULL_NUMBER]-short-descriptive-name
# something/[GROUP_NUMBER]/[PULL_NUMBER]-short-descriptive-name
function commit
set issue (git rev-parse --abbrev-ref HEAD | cut -d / -f 3 | cut -d - -f 1 | grep "^\d*\$")
set message $argv[1]
set prefix "Refs #"
@jmolivas
jmolivas / DefaultController.php
Last active August 20, 2022 18:57
Drupal 8 example: How to render a Twig template and load a CSS file from a Controller
<?php
namespace Drupal\acme\Controller;
use Drupal\Core\Controller\ControllerBase;
class DefaultController extends ControllerBase
{
/**
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 23, 2024 04:22
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@delphian
delphian / drupal-7-example-local-settings.php
Created August 15, 2013 17:12
Example of drupal 7 local settings.php file.
<?php
// To set up a local environment, make a duplicate of this file and name it
// local-settings.inc in the site directory that contains the settings.php file.
// Ignore sites/*/local-settings.php in the .gitignore file. Change the settings.php
// file to include local-settings.php if the file exists.
// Point database to local service.
$databases['default']['default'] = array(
'database' => 'local_db_name',
@liorkesos
liorkesos / 1 - server.js
Last active November 22, 2016 16:54
MEAN.io code walkthrough
/*!
* nodejs-express-mongoose-demo
* Copyright(c) 2013 Madhusudhan Srinivasa <madhums8@gmail.com>
* MIT Licensed
*/
/**
* Module dependencies.
*/