Skip to content

Instantly share code, notes, and snippets.

View dmsmidt's full-sized avatar

Daniël Smidt dmsmidt

View GitHub Profile
@dmsmidt
dmsmidt / dsite.bash
Last active February 11, 2017 09:41
Prepare a local Drupal install. Git checkout, nginx setup, create MySql database.
#!/bin/bash
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
while true; do
@dmsmidt
dmsmidt / drupal8.conf
Created February 11, 2017 09:22
Drupal 8 nginx include
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
@dmsmidt
dmsmidt / config.fish
Created November 16, 2016 16:36
Fish Settings | Drupal + Git Prompt
# Set binary paths.
set PATH /usr/local/bin $PATH
set PATH ~/bin $PATH
set PATH ~/.config/composer/vendor/bin $PATH
set PATH echo (ruby -e 'print Gem.user_dir')/bin $PATH
set -x COMPOSER_DISABLE_XDEBUG_WARN 1
# Start X at login on TTY1
if status --is-login
@dmsmidt
dmsmidt / MigrateEntityFileUri.inc.php
Created January 19, 2016 15:03
MigrateEntityFileUri Allow saving File Entity fields with Drupal 7 Migrate
<?php
/**
* Handle cases where we're handed a URI, or local filespec. Extra functionallity: Allow saving file entity fields.
*/
class MigrateEntityFileUri extends MigrateFileUri {
public function __construct($arguments = array(), $default_file = NULL) {
parent::__construct($arguments, $default_file);
if (isset($arguments['fields'])) {
$this->fields = $arguments['fields'];
@dmsmidt
dmsmidt / hook_views.php
Last active February 27, 2017 08:23
Drupal 7 views hooks in execution order.
<?php
/**
* Implements hook_views_pre_view().
*/
function hook_views_pre_view(&$view, &$display_id, &$args) {
$foo = 'bar';
}
/**
@dmsmidt
dmsmidt / dcron.php
Last active August 29, 2015 14:24
Drupal 7 Drush Cron Verbose (with timing)
<?php
// Can be called with '$ drush php-scrip /path/to/dcron.php'
global $timers;
$hook = "cron";
$return = array();
$queues = module_invoke_all("cron_queue_info");
drupal_alter("cron_queue_info", $queues);
foreach (module_implements($hook) as $module) {