Skip to content

Instantly share code, notes, and snippets.

View Deele's full-sized avatar

Nils Deele

View GitHub Profile
@Deele
Deele / backup_drupal_project.sh
Last active August 21, 2019 13:31
Create backup archive of Drupal project files
#!/bin/bash
#
# Settings
#
DIRECTORY="drupal-project"
#
# Begin
@Deele
Deele / mail_tester.php
Last active November 4, 2019 15:34
Mail sending tester via Sfiftmailer (originally made for use with `drupal/swiftmailer` and `drupal/smtp` composer packages installed)
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$autoloadPath = 'autoload.php';
if (!file_exists($autoloadPath)) {
$autoloadPath = '../' . $autoloadPath;
if (!file_exists($autoloadPath)) {
$autoloadPath = '../' . $autoloadPath;
}
@Deele
Deele / README.md
Last active July 13, 2021 18:56 — forked from TylerFisher/README.md
Google Spreadsheets script to generate transliterated slugs from a range of cells

This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.

Use it like this!

# A B C
1 a b slug
2 foo baz bing =slugify(A2:B4)
3 bar BAZ
4 FOO baz-bing
@Deele
Deele / ContentEntityMigrationTool.php
Created March 14, 2019 09:58
Drupal 8 Content Entity Migration Tool
<?php
/**
* @property integer $total Total entities in set
* @property array $unchanged entities that were left unchanged
* @property array $succeeded entities that was successfully migrated
* @property array $failed entities that failed to migrate
* @property bool $success if all the entities were successfully migrated
*/
class ContentEntityMigrationResult extends stdClass
@Deele
Deele / updateSettings.js
Last active June 6, 2018 02:06
Deep extend of JSON-type settings (JS objects) with options (JS objects)
/**
* @param {object} settings
* @param {object} options
* @returns {object}
*/
function updateSettings(settings, options) {
var updatedSettings = {};
if (typeof settings !== 'undefined') {
Object.assign(updatedSettings, settings);
}
@Deele
Deele / duplicateIdsMonitoring.js
Last active September 4, 2017 14:26
Monitors document body for duplicate IDs and warns in console when that happens (potential for chrome extension)
(function (window) {
// Based on https://stackoverflow.com/a/14570614/588973
window.observeDOM = (function () {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
eventListenerSupported = window.addEventListener;
return function (obj, callback) {
if (MutationObserver) {
// define a new observer
@Deele
Deele / TinyMce.php
Last active July 28, 2017 09:46
Implemented an option to call widget initialization on demand (for PJAX, AJAX or other purposes).
<?php
/**
* @copyright Copyright (c) 2013-2017 2amigOS! Consulting Group LLC
* @link http://2amigos.us
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
namespace dosamigos\tinymce;
use yii\helpers\Html;
use yii\helpers\Json;
@Deele
Deele / backend__config__main.php
Last active July 29, 2021 19:28
Yii2 (advanced app) - Creating frontend URLs in backend and vice versa
<?php
$config = [
'components' => [
// [...]
'request' => [
'baseUrl' => $params['backend.baseUrl'],
],
'urlManagerFrontend' => [
'class' => 'yii\web\UrlManager',
'baseUrl' => $params['frontend.baseUrl'],
@Deele
Deele / CreatingDrupal8Site.md
Created May 10, 2016 12:50
Creating Drupal 8 site
@Deele
Deele / horizontal-bootstrap-activeform-checkbox-view.php
Last active December 3, 2015 11:35
Yii2 Bootstrap ActiveForm horizontal layout checkbox syntax
<?php
use yii\bootstrap\ActiveForm;
use yii\bootstrap\ActiveField;
$activeField = new ActiveField();
?><div class="tour-form">
<?php $form = ActiveForm::begin(); ?>
<div class="form-horizontal">
<?php
echo <<<HTML
{$form->field(