Skip to content

Instantly share code, notes, and snippets.

View damircalusic's full-sized avatar

Damir Calusic damircalusic

View GitHub Profile
@enjikaka
enjikaka / durationToMinutes.js
Last active January 14, 2018 13:28
HTML 5.1 Duration string / dateTime to minutes
export default function durationToMinutes (durationString) {
return durationString
.match(/\d+\w/g)
.map(u => ([parseInt(u.match(/\d+/g), 10), u.split(/\d+/g)[1]]))
.map(a => {
switch (a[1]) {
case 'D': return a[0] * 1440;
case 'H': return a[0] * 60;
case 'M': return a[0];
case 'S': return a[0] / 60;
@bitfade
bitfade / filter.js
Last active October 5, 2018 18:09
WordPress 3.5 media upload, toolbar with custom filter
/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */
/*global wp,jQuery */
jQuery(document).ready(function($) {
if (!window.wp || !window.wp.media) {
return;
}
var media = window.wp.media;