This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const SingleMessage: FC<Message & { highlight: boolean; index?: number }> = ({ | |
id, | |
author, | |
createdAt, | |
content, | |
highlight, | |
index, | |
}) => { | |
const [messageTime, setMessageTime] = useState<string>(() => | |
calculateCommentTime(createdAt, new Date()), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import express from 'express'; | |
import fileUpload from 'express-fileupload'; | |
import { pythonRunningProcess, spawnPythonProcess } from './spawn-python-process'; | |
import { useRunningPythonServer } from './use-running-python-server'; | |
const downloadsFolder = path.resolve(__dirname, './downloads'); | |
let isProcessing = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only built-in Node.js dependencies | |
const fs = require('fs') | |
const path = require('path') | |
const util = require('util') | |
// working dir | |
const dir = 'C:\\Users\\werey\\Documents\\Scanned Documents' | |
// difference between file name counter and page number on image | |
const offset = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Given gist shown the "fetch-on-render" patter - the most popular, but with | |
the "waterfall" downside. | |
"Waterfall" means starting fetching AFTER rendering process is finished. | |
This task implies to show the "render-as-you-fetch" pattern - to start these 2 | |
processes simultaneously. To achieve it the requests should be sent not in the | |
useEffect (coupled with rendering) but in Relay's layer often called "resource". | |
Under the hood this "resource": | |
1. either throws the contract-based object and the nearest <ErrorBoundary/> parent catches it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mapValues from 'lodash/mapValues'; | |
export type WindvanePaths<PNms, PIds, Pths> = { | |
[key in keyof Pths]: Array<keyof PNms | keyof PIds>; | |
} | |
export interface WindvaneOptions<PNms, PIds, Pths> { | |
pathNames: PNms; | |
pathIds: PIds; | |
pathsConcatScheme: WindvanePaths<PNms, PIds, Pths>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pathIds, pathNames, paths | |
export enum urlPathIds { | |
PATIENT_ID = 'patientId', | |
MEASUREMENT_ID = 'measurementId', | |
NOTE_ID = 'noteId', | |
} | |
export enum urlPathNames { | |
OVERVIEW = 'overview', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// windvane.test.ts | |
import {windvane} from '../../../services/RoutingService/windvane'; | |
describe('windvane URL util', () => { | |
const wv = windvane({ | |
pathNames: { | |
locations: 'locations', | |
new: 'create', | |
users: 'people', | |
about: 'about', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends ../../layout | |
block title | |
title CYPI: About us | |
block styles | |
link(rel="stylesheet" type="text/css" href="css/about.css")/ | |
block content | |
.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states: | |
Every even integer greater than 2 can be expressed as the sum of two primes. | |
For example: | |
`6 = 3 + 3`</br> | |
`8 = 3 + 5`</br> | |
`10 = 3 + 7 = 5 + 5`</br> | |
`12 = 5 + 7` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_col_name(col): | |
abc = " ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
col_name = "" | |
while col > 0: | |
letter_index = col % 26 | |
if letter_index == 0: | |
letter_index = 26 | |
col -= 26 | |
col //= 26 | |
col_name = abc[letter_index] + col_name |
NewerOlder