setTimeout
caps out at ~25 days.
If you need a bigger timeout, use setBigTimeout
.
import { setBigTimeout } from "./mod.mts";
const FORTY_DAYS_IN_MILLISECONDS = 3.456e9;
import * as b64ArrBufferConvertor from "base64-arraybuffer"; | |
const SECRET_HMAC_KEY = | |
"209C5BBE79E2752FD1E4E687AD410778DD098546CC9B15ECAB1AEB4F21A46EF2"; | |
async function importHmacSecretKey(secret: string) { | |
return crypto.subtle.importKey( | |
"raw", | |
new TextEncoder().encode(secret), | |
{ name: "HMAC", hash: "SHA-256" }, | |
false, |
setTimeout
caps out at ~25 days.
If you need a bigger timeout, use setBigTimeout
.
import { setBigTimeout } from "./mod.mts";
const FORTY_DAYS_IN_MILLISECONDS = 3.456e9;
document.addEventListener("contextmenu", function(event) { | |
event.preventDefault(); | |
alert("Right-click is disabled on this website!"); | |
}); | |
// Disable Right-Click for Specific Elements Only | |
document.getElementById("protected-content").addEventListener("contextmenu", function(event) { | |
event.preventDefault(); | |
}); |
We first define a generic MinHeap class with the following operations:
import ko from 'knockout'; | |
import {getLogger} from 'Util/Logger'; | |
export const serverTimeHandler = { | |
computeTimeOffset(serverTimeString: string): void { | |
const timeOffset = Date.now() - new Date(serverTimeString).valueOf(); | |
this.timeOffset(timeOffset); | |
this.logger.log(`Current backend time is '${serverTimeString}'. Time offset updated to '${this.timeOffset()}' ms`); | |
}, |
import { defineConfig } from "@farmfe/core"; | |
export default defineConfig({ | |
plugins: [ | |
{ | |
name: "NestJS", | |
priority: 0, | |
config(config) { | |
const inputFileEntry = Object.values(config?.compilation?.input || {})[0] ?? "src/main.ts"; | |
const mode = config.compilation.mode ?? process.env.NODE_ENV ?? "development"; |
import React, {useState} from "react"; | |
export const DragAndDrop = () => { | |
const cardData = [ | |
{ | |
id: 1, | |
image: "https://i.ibb.co.com/XxvZ2Kq/Logo.png" | |
}, | |
{ | |
id: 2, |
import cluster from "node:cluster"; | |
import { Injectable } from "@nestjs/common"; | |
import { cpuCountSync } from "node-cpu-count"; | |
const numCPUs = cpuCountSync(); | |
@Injectable() | |
export class AppClusterService { | |
static register(callback: () => void): void { | |
if (cluster.isPrimary) { |
I find a solution for this, in finder, if the hosts file has a lock on it, use this command to unlock it:
sudo chflags nouchg,noschg /etc/hosts
then it will be editable by root, so you can use sudo nano /etc/hosts
.
BTY, you can find hosts file in finder by this command: open /etc
.
export const convertDate = (date: Date | string) => { | |
if (typeof date === "string") { | |
const d = new Date(date); | |
return d.toISOString().slice(0, 19).replace("T", " "); | |
} | |
return date.toISOString().slice(0, 19).replace("T", " "); | |
}; | |
export const getNow = () => { | |
return new Date(convertDate(new Date())); |