Skip to content

Instantly share code, notes, and snippets.

View reggi's full-sized avatar
🪷

Tea Reggi reggi

🪷
View GitHub Profile
echo "\nchanging the directory to home dir --------------------------------------------------------------------------------------------------------\n"
cd ~/
echo "\nkilling all running mongo processes -------------------------------------------------------------------------------------------------------\n"
mongod --shutdown --config /shared/replica-sets/mongod-repl-1.conf
mongod --shutdown --config /shared/replica-sets/mongod-repl-2.conf
mongod --shutdown --config /shared/replica-sets/mongod-repl-3.conf
echo "\nremoving all data directories -------------------------------------------------------------------------------------------------------------\n"
rm -rf /var/mongodb/db/1
@reggi
reggi / question-nestjs-graphql-nested-resolvers.md
Last active July 10, 2023 14:11
How do I have nested resolvers in nestjs / type-graphql?

I am trying to find a way that a resolver can essentially return another resolver using [nest.js][1] for creating [Resolvers][2], and [type-graphql][3] to create [object types][4].

Here's an example with the star-wars graphql api

{
  allVehicles(first: 1, last: 100) {
    vehicles {
      name
export function ServiceState<G>(): new () => { value?: G, set(type: G): G }
export function ServiceState<G>(type: G): new () => { value: G, set(type: G): G }
export function ServiceState<G>(type?: G) {
return class ServiceState {
value: G | undefined
constructor() {
this.value = type
}
@reggi
reggi / Fox.ts
Last active February 10, 2021 06:59
namespace Fox {
export namespace Suppress {
type ThenArg<T> = T extends Promise<infer U> ? U : T
type ReturnAdd<T extends Func, G> = ReturnType<T> extends Promise<infer U> ? Promise<ThenArg<ReturnType<T>> | G> : ReturnType<T> | G
export type Func = (...args: any[]) => any
export type Return<T extends Func> = ReturnAdd<T, undefined>
}
import {journey} from '@reggi/journey'
import * as lodash from 'lodash'
const getPairs = (obj) => lodash.entries(obj).map(([key, method], index) => ({key, method, index}));
const nestedReduce = (pairs, cb) => {
return pairs.reduce((acq, fromPair) => {
acq[fromPair.key] = pairs.reduce((acq, toPair) => {
const r = cb({ fromPair, toPair });
if (r) acq[toPair.key] = r;
const libs = []
export enum Types {
number,
numbers,
string,
buffer,
}
export enum Actions {
declare const lodash: typeof import('lodash')
export = lodash
enum Outing {
COMEDY,
DJ_DANCE_PARTY,
SIT_DOWN_LIVE_MUSIC,
BOARD_GAME_NIGHT,
MOVIE,
CONCERT,
THEATER,
DANCE_PROFORANCE,
BILLIARDS,
@reggi
reggi / dates.txt
Created October 10, 2018 14:24 — forked from azampagl/statetmzs.py
State to timezone conversion.
Pacific/Apia (GMT-11:00) Samoa Standard Time (Apia)
Pacific/Pago_Pago (GMT-11:00) Samoa Standard Time (Pago Pago)
Pacific/Honolulu (GMT-10:00) Hawaii-Aleutian Standard Time
America/Adak (GMT-09:00) United States (Adak)
America/Anchorage (GMT-08:00) Alaska Daylight Time
America/Ensenada (GMT-08:00) Pacific Standard Time
America/Mazatlan (GMT-07:00) Mountain Standard Time (Mazatlan)
America/Phoenix (GMT-07:00) Mountain Standard Time (Phoenix)
America/Los_Angeles (GMT-07:00) Pacific Daylight Time (Los Angeles)
America/Vancouver (GMT-07:00) Pacific Daylight Time (Vancouver)
var fs = require('fs')
var axios = require('axios')
var _ = require('lodash')
const bb = require('bluebird')
bb.promisifyAll(fs)
async function example () {
const file = await fs.readFileAsync('./urls.txt','utf8')
const urls = file.split('\n')
const action = await bb.map(urls, async (url) => {