Skip to content

Instantly share code, notes, and snippets.

Nils Deele

Block or report user

Report or block Deele

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Deele
Deele / baseHtml.js
Created Jan 7, 2015
Port of Yii2 BaseHtml class that provides a set of static methods for generating commonly used HTML tags
View baseHtml.js
/**
* Returns whether given variable is undefined
*
* @author Nils Lindentals <nils@dfworks.lv>
* @license GNU GPL v2.0
*
* @param variable
* @returns {boolean}
*/
function isUndefined(variable) {
@Deele
Deele / sse.html
Last active Mar 2, 2018
Server-Sent Events example, Javascript client-side, PHP server-side
View sse.html
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);
@Deele
Deele / horizontal-bootstrap-activeform-checkbox-view.php
Last active Dec 3, 2015
Yii2 Bootstrap ActiveForm horizontal layout checkbox syntax
View horizontal-bootstrap-activeform-checkbox-view.php
<?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(
@Deele
Deele / CreatingDrupal8Site.md
Created May 10, 2016
Creating Drupal 8 site
View CreatingDrupal8Site.md
@Deele
Deele / backend__config__main.php
Last active Nov 9, 2019
Yii2 (advanced app) - Creating frontend URLs in backend and vice versa
View backend__config__main.php
<?php
$config = [
'components' => [
// [...]
'request' => [
'baseUrl' => $params['backend.baseUrl'],
],
'urlManagerFrontend' => [
'class' => 'yii\web\UrlManager',
'baseUrl' => $params['frontend.baseUrl'],
@Deele
Deele / TinyMce.php
Last active Jul 28, 2017
Implemented an option to call widget initialization on demand (for PJAX, AJAX or other purposes).
View TinyMce.php
<?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 / duplicateIdsMonitoring.js
Last active Sep 4, 2017
Monitors document body for duplicate IDs and warns in console when that happens (potential for chrome extension)
View duplicateIdsMonitoring.js
(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 / updateSettings.js
Last active Jun 6, 2018
Deep extend of JSON-type settings (JS objects) with options (JS objects)
View updateSettings.js
/**
* @param {object} settings
* @param {object} options
* @returns {object}
*/
function updateSettings(settings, options) {
var updatedSettings = {};
if (typeof settings !== 'undefined') {
Object.assign(updatedSettings, settings);
}
@Deele
Deele / ContentEntityMigrationTool.php
Created Mar 14, 2019
Drupal 8 Content Entity Migration Tool
View ContentEntityMigrationTool.php
<?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 / README.md
Last active Apr 5, 2019 — forked from TylerFisher/README.md
Google Spreadsheets script to generate transliterated slugs from a range of cells
View README.md

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
You can’t perform that action at this time.