Skip to content

Instantly share code, notes, and snippets.

View Dewep's full-sized avatar

Maigret Aurélien Dewep

View GitHub Profile
@Dewep
Dewep / durationToString.js
Created October 26, 2016 14:05
Duration to string
/* Units: ms, s, m, h, d */
window.durationToString = function (duration, unit, minRate) {
var str = ''
unit = unit.toLowerCase()
if (minRate === undefined) {
minRate = 0.02
}
if (unit.startsWith('s')) {
duration *= 1000
@Dewep
Dewep / example.js
Created January 10, 2017 14:30
MultiPart Uploader
function onChange(event) {
if (this.fileUploading) {
this.appEventsService.emit("error", "A file is already uploading.")
} else if (!event || !event.target || !event.target.files[0]) {
this.appEventsService.emit("error", "Input file error.")
} else if (!this.user || !this.user._id) {
this.appEventsService.emit("error", "User not found.")
} else {
var multiPartUploader = new MultiPartUploader({
url: this.apiService.baseApiPath + '/message/user/' + this.user._id + '/attachment',
@Dewep
Dewep / fonts.js
Created April 1, 2019 14:42
pdf.js/src/core/fonts.js
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,