Skip to content

Instantly share code, notes, and snippets.

View frankyonnetti's full-sized avatar

Frank Yonnetti frankyonnetti

View GitHub Profile
@frankyonnetti
frankyonnetti / homebrew.sh
Last active February 17, 2021 00:37
Homebrew #homebrew #terminal
# Install Homebrew
1. xcode-select --install
2. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# http://mxcl.github.com/homebrew
#
# https://github.com/mxcl/homebrew
# https://github.com/mxcl/homebrew/wiki
# http://matthewcarriere.com/2013/08/05/how-to-install-and-use-homebrew/
@frankyonnetti
frankyonnetti / eslint-jshint.md
Last active February 17, 2021 00:39
eslint #eslint #javascript
@frankyonnetti
frankyonnetti / drush-install-with-composer.sh
Last active May 22, 2021 19:55
Drush - install with composer #drush #composer
# https://docs.designhammer.net/cms/drush/
# From your home dir.
# download
$ curl -sS https://getcomposer.org/installer | php
# move file
$ mv composer.phar /usr/local/bin/composer
# install cgr globally (may not be needed)
@frankyonnetti
frankyonnetti / drupal8-views-block.twig
Last active February 17, 2021 00:41
Drupal 8 - views block #drupal #d8 #views #blocks
<div class="block-views-blockresults-node-blocks-block-2">
<h2>Title</h2>
{# view name block name #}
{{ drupal_view('results_node_blocks', 'block_2') }}
</div>
@frankyonnetti
frankyonnetti / drupal8-media-image-uri.twig
Last active May 23, 2021 18:57
Drupal 8 - media image uri #drupal #d8 #media #img
To get media uri, make sure view mode for field is set to "rendered entity"
```twig
{% set background_image_uri = file_url(content.field_photo_cta_photo[0]['#media'].field_media_image.entity.uri.value) %}
```
Get the media path in a view twig template
@frankyonnetti
frankyonnetti / drupal8-cache.md
Last active April 16, 2025 18:29
Drupal 8 - cache #drupal #d8 #cache

Disable Drupal 8 caching during development

  1. Copy and rename:
  • sites/example.settings.local.php --> sites/default/settings.local.php
  • uncomment the following lines (search for it):
  $settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
 $settings['cache']['bins']['render'] = 'cache.backend.null';
@frankyonnetti
frankyonnetti / drupal7-watchdog-trace.php
Last active February 17, 2021 00:43
Drupal 7 - watchdog trace #drupal #d7 #watchdog
<?php
if (isset($log_entry['variables']) && !is_array($log_entry['variables'])) {
print json_encode(debug_backtrace());
}
@frankyonnetti
frankyonnetti / drupal7-use-specific-field-in-page.tpl.php
Last active February 17, 2021 00:45
Drupal 7 - use specific field in page #drupal #d7 #tpl
<?php
/**
*
* http://josephfitzsimmons.com/creating-a-hero-page-template-in-drupal/
*
*/
// template.php
@frankyonnetti
frankyonnetti / drupal7-path-from-nid.php
Last active February 17, 2021 00:46
Drupal 7 - path from nid #drupal #d7 #nid #path
<?php
// in search results
$physician_nid = $result['node']->nid;
$path = 'node/' . (int) $physician_nid;
$alias = drupal_get_path_alias($path);
print '<a href="' . $alias . '">Physician Profile</a>';
@frankyonnetti
frankyonnetti / drupal7-local-settings.php
Last active February 17, 2021 00:47
Drupal 7 - local settings #drupal #d7 #settings
//Override default local database settings
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'database_local',
'username' => 'root',
'password' => 'root',
'host' => 'localhost',