Skip to content

Instantly share code, notes, and snippets.

@iprodev
iprodev / array_diff_multidimensional.php
Last active April 11, 2019 20:46
PHP : Computes the difference between multidimensional arrays
<?php
/**
* Computes the difference between two arrays
*
* @param array $array1
* @param array $array2
* @return array
*/
function array_diff_two( $array1, $array2 ) {
$diff = array();
@iprodev
iprodev / replace_arrays_with_default_properties.php
Last active December 29, 2018 14:37
PHP : Replace the contents of two or more arrays together into the first array with default properties.
<?php
/**
* Replace the contents of two or more arrays together into the first array with default properties.
*
* @param array $default The array to replace. It will receive the new properties.
* @param array $arrayN An array containing additional properties to merge in.
* @return array
*/
function array_replace_default() {
$arguments = func_get_args();
@iprodev
iprodev / gist:b29fa4b0a613077c49972a85e5fff6a9
Created March 21, 2020 20:11 — forked from timonweb/gist:3165322
Code to catch all PHP errors which result in 500 Error Code. Include this snippet at the beginning of index.php file
<?php
define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
define('ENV', 'dev');
//Custom error handling vars
define('DISPLAY_ERRORS', TRUE);
define('ERROR_REPORTING', E_ALL | E_STRICT);
{"lastUpload":"2020-11-08T16:10:09.746Z","extensionVersion":"v3.4.3"}
@iprodev
iprodev / popup.js
Last active May 17, 2020 16:23
Opens a new browser window
/**
* Opens a new browser window
* @param {String} url The url of the window to open
* @param {String} name The name of this window
* @param {Number} width Window width
* @param {Number} height Window height */
const popUpWindow = (url, name, width, height)=> {
// Center the window
let _width = Math.min(width || 640, screen.availWidth),
_height = Math.min(height || 480, screen.availHeight),
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Animator = factory());
}(this, function () {
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame,
cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame,
pow = Math.pow,
sqrt = Math.sqrt,
sin = Math.sin,