This file contains 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 { promisify } from 'node:util'; | |
import type { ArraySlice, LastArrayElement } from 'type-fest'; | |
type AnyoneFunction = (...args: any) => any; | |
type PickCallbackReturnType<F extends AnyoneFunction> = | |
LastArrayElement<Parameters<F>> extends AnyoneFunction | |
? Promise<LastArrayElement<Parameters<LastArrayElement<Parameters<F>>>>> | |
: never; |
This file contains 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
const fs = require('fs'); | |
const os = require('os'); | |
const tunnelSsh = require('tunnel-ssh'); | |
const { Pool } = require('pg'); | |
(async () => { | |
/** @type {import('net').Server} */ | |
let tunnel; | |
try { |
This file contains 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
package Example::TT2::M; | |
use strict; | |
use warnings; | |
use base 'Template::Plugin'; | |
use Locale::CLDR; | |
use Scalar::Util qw/looks_like_number/; | |
sub new { |
This file contains 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
#!/usr/bin/env node | |
// @ts-check | |
const https = require('https'); | |
const { finished } = require('stream'); | |
load_rss_feed_titles('https://news.google.com/rss?hl=en-US&gl=US&ceid=US:en') | |
.then(console.log).catch(console.error); | |
load_rss_feed_titles('https://news.google.com/rss?hl=ru&gl=RU&ceid=RU:ru') | |
.then(console.log).catch(console.error); |
This file contains 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
// @ts-check | |
const fs = require('fs'); | |
const client = require("jsreport-client")("http://localhost:5488"); | |
const { finished } = require('stream'); | |
(async () => { | |
try { | |
const data = { | |
"customer": "Тратата через атом!!", |
This file contains 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
function possibleSums(coins, quantity) { | |
let arr = new Set(); | |
for (let i = 0, clen = coins.length; i < clen; i++) { | |
const coin = coins[i]; | |
const qty = quantity[i]; | |
const curr_sums = Array.from(arr); | |
const curr_coins = new Array(qty).fill().map((undefined, idx) => { | |
const n = coin * (idx + 1); | |
arr.add(n); | |
return n; |
This file contains 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
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Passkit Web Service", | |
"contact": { | |
"name": "Clemens Krack", | |
"email": "info@clemenskrack.com" | |
}, | |
"version": "1.0.0" | |
}, |
This file contains 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
const values = [1,2,null,3].map((x) => !!x || null); | |
const vlength = values.length; | |
let combinations = []; | |
for (let i = 0; i < vlength; i++) { | |
if (values[i]) { | |
let acc = []; | |
acc.push(new Array(vlength).fill(null).fill(true, i, i + 1)); | |
for (let j = vlength - 1; j > i; j--) { | |
if (values[j]) { | |
acc = acc.concat( |
This file contains 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
const fs = require('fs'); | |
const path = require('path'); | |
const testfile = path.join(path.resolve(), 'test.txt'); | |
read(testfile); | |
async function read(filepath) { | |
const rstream = fs.createReadStream(filepath, {highWaterMark: 70, encoding: 'utf-8'}); | |
let data; |
This file contains 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
#!/usr/bin/env node | |
const data = [ | |
{ id: 3, parentId: 1 }, | |
{ id: 2, parentId: 0 }, | |
{ id: 6, parentId: 4 }, | |
{ id: 4, parentId: 1 }, | |
{ id: 7, parentId: 5 }, | |
{ id: 5, parentId: 2 }, | |
{ id: 1, parentId: 0 } | |
]; |
NewerOlder