Skip to content

Instantly share code, notes, and snippets.

View vitaly-t's full-sized avatar
🐈
Meow!

Vitaly Tomilov vitaly-t

🐈
Meow!
View GitHub Profile
/*
According to Pierre Dusart, once x > 598, the following becomes true:
(x/ln x)(1 + 0.992/ln x) < π(x) < (x/ln x)(1 + 1.2762/ln x)
It means we need pre-calculated primes only up to 593.
See: https://primes.utm.edu/howmany.html
*/
export const primes = [
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
"C:\Program Files\Java\jdk-11.0.15\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\lib\idea_rt.jar=55119:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\bin" -Dfile.encoding=UTF-8 @C:\Users\vital\AppData\Local\Temp\idea_arg_file1322926934 ie.creditlogic.CollectLogicApplication
09:59:47,440 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:59:47,441 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:59:47,441 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Work/CL/collectlogic-api/build/resources/main/logback.xml]
09:59:47,495 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:59:47,499 |-
"C:\Program Files\Java\jdk-11.0.15\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\lib\idea_rt.jar=56450:C:\Program Files\JetBrains\IntelliJ IDEA 2022.1\bin" -Dfile.encoding=UTF-8 @C:\Users\vital\AppData\Local\Temp\idea_arg_file981706154 ie.creditlogic.CollectLogicApplication
10:24:26,154 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
10:24:26,154 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
10:24:26,155 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Work/CL/collectlogic-api/build/resources/main/logback.xml]
10:24:26,194 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10:24:26,198 |-I

FirstHome UI

Steps for changing local UI to use FirstHome interface layouts.

  1. Remove all database schemas.
  2. Re-run the API to auto-create the entire database.
  3. Add a firsthome tenant:
INSERT INTO text_item (id, language_code,
section,
key,
value,
version, created_by, modified_by,
modified_date, created_date)
VALUES (${uuid_function}, 'en',
'APPLICANT_IDV',
'CONTACT_US',
'Please contact us, if you are experiencing any issues submitting your identification',
-- Make IDV feature ON by default:
UPDATE cfg_feature SET enabled=true WHERE feature_key='ID_VERIFICATION';
INSERT INTO text_item (id, language_code,
section,
key,
value,
version, created_by, modified_by,
modified_date, created_date)
VALUES (${uuid_function}, 'en',
//////////////////
// RUN THIS FIRST: npm install [email protected]
//
// The example below crashes NodeJS (it runs out of memory)
// operator source: https://github.com/vitaly-t/iter-ops/blob/wait-cache/src/ops/async/wait-cache.ts
//////////////////
import {map, pipeAsync, waitCache} from 'iter-ops';
import {pipeAsync, map, waitRace, delay} from 'iter-ops';
const i = pipeAsync(
[1, 2, 3],
map(s => Promise.resolve(s * 10)),
delay(100),
waitRace(3)
);
(async function () {
import {pipe, reduce} from 'iter-ops';
const m = new Map<string, number>();
m.set('one', 1);
m.set('two', 2);
m.set('three', 3);
const i = pipe(m.values(), reduce((a, c) => a + c));
console.log(...i);
import {pipe, reduce} from 'iter-ops';
const m = new Map<string, number>();
m.set('one', 1);
m.set('two', 2);
m.set('three', 3);
const i = pipe(m.values(), reduce((a, c) => a + c, 5));
console.log(...i); //=> 11