Skip to content

Instantly share code, notes, and snippets.

View jsdev's full-sized avatar

Anthony "Ryan" Delorie jsdev

  • OPEN-TO-CONTRACTS
  • RESTON
  • X @jsdev
View GitHub Profile
@jsdev
jsdev / formatDuration.js
Created April 9, 2021 01:14
formatDuration method
// constraints: video 24 hours or less
export default duration => {
const afterHours = duration % 3600;
const hours = Math.floor(duration / 3600);
const minutes = Math.floor(afterHours / 60);
const seconds = Math.ceil(afterHours % 60);
return [hours, minutes, seconds]
.filter(o => o)
.map(o => o > 9 ? o : '0' + o).join(':');
@jsdev
jsdev / gist:8305476
Last active December 16, 2016 21:07
spacedOut method: takes a TitleCased or camelCased string and returns with appropriate spaces
const spacedOut = str => str.replace(/^[a-z]|[A-Z]/g, (v, i) => i === 0 ? v : " " + v);
@jsdev
jsdev / Iphone-svg-animation-.markdown
Created November 16, 2013 22:58
A Pen by Anthony Aubertin.