Skip to content

Instantly share code, notes, and snippets.

View Kosai106's full-sized avatar
👨‍💻

Kevin Østerkilde Kosai106

👨‍💻
View GitHub Profile
@Kosai106
Kosai106 / RouteIndicator.js
Created October 11, 2022 19:33 — forked from jaydenseric/RouteIndicator.js
A route change indicator for Next.js using React hooks.
import classNameProp from 'class-name-prop';
import { useRouter } from 'next/router';
import React from 'react';
import styles from './RouteIndicator.module.css';
const DONE_DURATION = 250;
export default function RouteIndicator() {
const router = useRouter();
@Kosai106
Kosai106 / file.js
Created February 4, 2020 23:17 — forked from odykyi/file.js
const hashCode = str => str.split('').reduce((prevHash, currVal) =>
(((prevHash << 5) - prevHash) + currVal.charCodeAt(0)) | 0, 0);
const sortByTime = (trx, nextTrx) => new Date(trx.time) - new Date(nextTrx.time);
const getMinutesFromDates = (startDate, endDate) => {
const difference = new Date(endDate).getTime() - new Date(startDate).getTime();
return (difference / 60000);
};
const findDuplicateTransactions = (transactions = []) => {
let map = new Map();