Skip to content

Instantly share code, notes, and snippets.

Avatar
📦
Building stuff.

Roman moltar

📦
Building stuff.
View GitHub Profile
View on-template.js
#!/usr/bin/env node
const { writeFileSync, readFileSync, unlinkSync } = require('fs')
const package = require('./package.json')
const packageLock = require('./package-lock.json')
const TEMPLATE_GITHUB_REPOSITORY = 'org/template'
const { GITHUB_REPOSITORY } = process.env
View index.ts
private async $request<R extends Runtype<any>>(config: AxiosRequestConfig, type?: R): Promise<Static<R>> {
// serialize to JSON
if (config.data && isObject(config.data)) {
config.data = JSON.stringify(config.data)
}
const { data, status, statusText } = await this.axios.request<any, AxiosResponse<Static<R>>>(config)
if (status === 204) {
return
@moltar
moltar / bull-arena-dynamic-queue-names.ts
Created Mar 3, 2020
A script that uses dynamic queue name discovery to build Bull Arena object, without having to manually specify each queue name.
View bull-arena-dynamic-queue-names.ts
import Arena from 'bull-arena'
import { uniq } from 'lodash'
import { getConnection } from './redis-connection'
import { config } from '../config'
const BULL_PREFIX = 'bull'
const HOST_ID = '__'
type Queue = Parameters<typeof Arena>[0]['queues'][0]
View hz.csv
name hz
JSON Encode Decode 79966.79245582566
runtypes 41973.09084616639
io-ts 337073.6125561012
class-validator sync 73694.89411739286
class-validator async 61958.63602038928
@moltar
moltar / keybase.md
Created Jun 29, 2019
Keybase Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am moltar on github.
  • I am m0ltar (https://keybase.io/m0ltar) on keybase.
  • I have a public key ASDLvYBxhyuKFzV36gxSdrS39t-KbM6KiCjaXBSL5L_xwAo

To claim this, I am signing this object:

View Untitled-1.js
module.exports = async function pdf(url, req) {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto(
'https://.....c9users.io/clients/' +
req.params.id +
'/reports/monthlyreport/' +
req.params.marketplace +
'/' +
View aorb.ts
interface A {
foo: number
}
interface B {
bar: number
}
type C = A | B
View test.ts
class A {
get a() {
return 1
}
}
class B {
get b() {
return 2
}
}
@moltar
moltar / bull.js
Created Jun 20, 2018
Assure bull only runs a single instance of a job
View bull.js
global.Promise = require('bluebird')
const Queue = require('bull')
const EventEmitter = require('events')
const JOB_NAME = 'testJob'
const PROGRESS_BUS_EVENT_NAME = 'progress'
const COMPLETED_PROGRESS_VALUE = 100
const { log } = console
View bootstrapVue.js
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved */
import Vue from 'vue'
import {
Layout, Modal, Button, FormGroup, FormInput,
FormTextarea, InputGroup, Jumbotron, Collapse, Card,
Tabs, Popover, Badge
} from 'bootstrap-vue/es/components'
Vue.use(Layout)