Skip to content

Instantly share code, notes, and snippets.

Avatar
👾

Andrew Svirin andrew-svirin

👾
View GitHub Profile
View AssocArrayArraysSort.php
<?php
/**
* Sorting class for array of associative arrays.
*
* Allows sort array by children array field value.
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*
* @example
* ```php
View stackable-modals.bootstrap.js
/**
* Make bootstrap modal dialogs stackable.
*/
$(document).on('show.bs.modal', '.modal', function () {
const zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex);
setTimeout(function() {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0);
});
View find-created-updated-deleted-jquery.js
/**
* Example ```javascript
* let objects = $.fn.findCreatedUpdatedDeleted(
* [{id:1, v:1}, {id:2, v:2}, {id:4, v:4}],
* [{id:null, v:3}, {id:2, v:3}, {id:4, v:5}],
* 'id',
* ['v'],
* 'new-'
* );
* console.log('result', objects);