Skip to content

Instantly share code, notes, and snippets.

Duvidas arch linux

  • Como usar nvme
    • Tem a ver com setores e pages e tal
  • Como usar swap com arquivo e se é a melhor opção
  • A atualização com pacman -Syu atualiza também o kernel caso tenha?
  • o que é btrfs é um sistama de arquivos como o ext4
  • O que é LVM é sobre subvolumes
  • Como criar backpus com snapshots do btrfs
<script setup>
// To get position got to metabase -> data tank -> tavola -> notarial_requirements or notarial_evidences
// example: {"kind": "manuscript", "pages": [{"page": "1", "position": [0.4445534838076546, 0.6160849772382397], "page_offset": [436, 1]}, {"page": "1", "position": [0.04121687929342493, 0.7283763277693475], "page_offset": [436, 1]}, {"page": "2", "position": [0.5417075564278705, 0.3247344461305007], "page_offset": [443, 1331]}]}
const signaturesPaste = ref('');
/**
* Converts a [x, y] percentage position to [x, y] in px given a [width, height] page size.
* @param {Array<Number>} position - [xPercent, yPercent] (0-1)
* @param {Array<Number>} pageSize - [widthPx, heightPx]
* @returns {Array<Number>} [xPx, yPx]
*/
Chrome >= 60
String.prototype.hashCode = function() {
var hash = 0,
i, chr;
if (this.length === 0) return hash;
for (i = 0; i < this.length; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
import { screen } from "@testing-library/vue";
import { createTestComponentRenderer } from "~~core/test";
import { mockNuxtImport } from "@nuxt/test-utils/runtime";
import { routerKey, createRouter, createWebHistory } from '#vue-router';
import { XButton } from "~~base-ui";
let router: ReturnType<typeof createRouter>;
beforeEach(async () => {
router = createRouter({
// setupFiles.ts
const { warn, log } = console;
const fnOverride = (callback: Function, ...msg: Array<[]>) => {
// if (!Object.getPrototypeOf(msg[0])) return callback(...msg);
const shouldIgnore = !!msg.find((m) => /Vue|mountOptions|FetchError/gi.test(String(m)));
if (!shouldIgnore) callback(...msg);
}
console.warn = (...args) => fnOverride(warn, ...args);
const sortSignaturesByDiagonalDistance = (a, b) => {
// await nextTick();
console.log('sort');
if (!a.signatureRef) return 0;
// Get the absolute position of the child relative to the parent
const { top: distanceFromTopA, left: distanceFromLeftA } = a.signatureRef.getBoundingClientRect();
const { top: distanceFromTopB, left: distanceFromLeftB } = b.signatureRef.getBoundingClientRect();
import { processCoordinateForBackend } from '..';
import { groupBy, merge } from 'lodash';
export const useMountPositionSignPayload = (archives, signatures) => {
if (signatures.value.length === 0) {
return archives.value.reduce((acc, curr) => {
const url = curr.links.rubrics;
acc[url] ||= { rubric: [] };
@valterbarros
valterbarros / get-page-size.js
Created September 22, 2023 18:16
get original pdf page size
/** @typedef {import("pdfjs-dist/lib/display/api.js").PDFDocumentProxy} PDFDocumentProxy */
/**
* @param {String} pdfUrl
* @param {PDFDocumentProxy} documentProxy - pdf.js document proxy object
*/
const handleGetPageSize = async ({ pdfUrl, documentProxy }) => {
const documentKey = archives.value.find((archive) => archive.documentPdfUrl === pdfUrl).key;
const pageBaseList = Array.from({ length: documentProxy.numPages });
const pageOriginalSizePromise = pageBaseList.map(async (_item, index) => {
import {
isTimeElapsedBeforeEndTime,
getDateTimeElapsedSincePageLoaded,
getDurationBetweenTimes,
} from '@/utils/date';
class myMap extends Map {
deleteByValue(valueToRemove) {
console.log('delete', this, valueToRemove)
this.forEach((value, key) => {