Skip to content

Instantly share code, notes, and snippets.

@cdmz
cdmz / msconvert.js
Last active September 1, 2015 14:16 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
@cdmz
cdmz / sort_array_multidim.php
Created October 6, 2015 12:57 — forked from tufanbarisyildirim/sort_array_multidim.php
sort a multidimensional array by sql like order by clause
<?php
/**
* @name Mutlidimensional Array Sorter.
* @author Tufan Barış YILDIRIM
* @link http://www.tufanbarisyildirim.com
* @github http://github.com/tufanbarisyildirim
*
* This function can be used for sorting a multidimensional array by sql like order by clause
*
* @param mixed $array
@cdmz
cdmz / mutex.js
Created October 22, 2015 01:11 — forked from oivoodoo/mutex.js
mutex
var Mutex = function() {
this.queues = [];
this.locked = false;
};
Mutex.prototype = {
push: function(callback) {
var self = this;
this.queues.push(callback);
if (!this.locked) {
@cdmz
cdmz / gifencoder.class.php
Created October 10, 2016 01:05 — forked from allometry/gifencoder.class.php
GIFEncoder Class
<?php
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFEncoder Version 2.0 by László Zsidi, http://gifs.hu
::
:: This class is a rewritten 'GifMerge.class.php' version.
::
:: Modification:
:: - Simplified and easy code,