Skip to content

Instantly share code, notes, and snippets.

View stropitek's full-sized avatar

Daniel Kostro stropitek

View GitHub Profile
@stropitek
stropitek / debounceFunction.ts
Created January 11, 2021 09:57
Debounce function execution
// Not using recursive types because it is recommend to use those carefully
// for performance reasons
type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
// debounce function which resolves with undefined when call has been cancelled
// The function returns a promise which resolves with awaited return value of the callback
// Except if the callback call was canceled because of the debouncing in which case
// the promise resolves with undefined
export default function debounce<T>(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
'use strict';
const data = [1487868586378,1487857485296,"2016-06-10T11:15:13.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:32.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:31.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:27.000Z","2008-05-16T11:57:13.000Z","2008-05-16T11:57:13.000Z","2008-05-16T11:57:13.000Z","2008-05-16T11:57:12.000Z","2008-05-16T11:57:12.000Z",1485944753582,1485871296146,1485871143711,1484125236275,1484069406406,"2008-05-16T11:57:41.000Z"];
const timsort = require('.');
timsort.sort(data, function (a, b) {
if (a < b) return -1;
else if (a > b) return 1;
return 0
});

Keybase proof

I hereby claim:

  • I am stropitek on github.
  • I am stropitek (https://keybase.io/stropitek) on keybase.
  • I have a public key whose fingerprint is 5A1E 5EBD AD14 6E97 7435 A9D7 6798 C77C DA80 5155

To claim this, I am signing this object:

@stropitek
stropitek / Running_10-45-03.gpx
Last active November 15, 2015 22:31
Running traces
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" version="1.1" creator="TomTom" xmlns="http://www.topografix.com/GPX/1/1">
<metadata>
<name>Running_10-45-03.gpx</name>
</metadata>
<trk>
<name>RUNNING</name>
<trkseg>
<trkpt lon="6.621107" lat="46.513624">
<ele>413</ele>