Skip to content

Instantly share code, notes, and snippets.

@hawkeyetwolf
hawkeyetwolf / -dotfiles
Last active July 17, 2021 17:11
dotfiles + other config
.
@fmfpereira
fmfpereira / gist:4186d4e40b09b2b49f2a4c91576be78c
Created December 18, 2017 18:02
Remove uuid, _core and default_config_hash from Drupal 8.x profile install config files.
sed -i "/^uuid:/d;/^_core:/d;/^ default_config_hash:/d" *
@katopz
katopz / setup-zeromq.sh
Last active December 8, 2025 19:47 — forked from cdjhlee/zeromq_install.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@crittermike
crittermike / import.php
Last active June 6, 2025 11:21
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
@vasi
vasi / uuid.php
Last active November 11, 2021 15:23
Modify Drupal's config UUIDs to match a config dir
<?php
use Symfony\Component\Yaml\Yaml;
global $config_directories;
$config_name = drush_shift();
if (!isset($config_directories[$config_name])) {
print "No such config directory $config_name\n";
exit;
}
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
echo '' >> $HOME/.bashrc
echo 'function composer() { COMPOSER="$(which composer)" || { echo "Could not find composer in path" >&2 ; return 1 ; } && sudo phpdismod -s cli xdebug ; $COMPOSER "$@" ; STATUS=$? ; sudo phpenmod -s cli xdebug ; return $STATUS ; }' >> $HOME/.bashrc
echo 'function drush() { DRUSH="$(which drush)" || { echo "Could not find drush in path" >&2 ; return 1 ; } && sudo phpdismod -s cli xdebug ; $DRUSH "$@" ; STATUS=$? ; sudo phpenmod -s cli xdebug ; return $STATUS ; }' >> $HOME/.bashrc
echo 'function drupal() { DRUPAL="$(which drupal)" || { echo "Could not find drupal in path" >&2 ; return 1 ; } && sudo phpdismod -s cli xdebug ; $DRUPAL "$@" ; STATUS=$? ; sudo phpenmod -s cli xdebug ; return $STATUS ; }' >> $HOME/.bashrc
echo '' >> $HOME/.bashrc
@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 #}
@samuelsolis
samuelsolis / Form.php
Last active October 26, 2022 18:52
Change Field value in drupal 8 form with Ajax
<?php
/**
* Form controller for the bb_report entity edit forms.
*
* @ingroup report
*/
class FeeForm extends ContentEntityForm {
/**
* {@inheritdoc}