Skip to content

Instantly share code, notes, and snippets.


Thomas Reggi reggi

View GitHub Profile
View tumblr-theme.html
<!DOCTYPE html>
<html lang="en" id="{block:IndexPage}index{/block:IndexPage}{block:PermalinkPage}permalink{/block:PermalinkPage}" class="no-js {block:ifNotInfiniteScroll}no-{/block:ifNotInfiniteScroll}infscr {block:ifNotEnableAnimations}no-{/block:ifNotEnableAnimations}animations transitions {block:ifNotFadeInPosts}no-{/block:ifNotFadeInPosts}fadein {block:ifNotLoadPostsIndividually}no-{/block:ifNotLoadPostsIndividually}loadsolo not-mobile {block:ifTransparentPostBackground}transbg{/block:ifTransparentPostBackground} {block:ifBorderAroundIndexPosts}border-post{/block:ifBorderAroundIndexPosts} {block:ifBorderAroundPermalinkContent}border-content{/block:ifBorderAroundPermalinkContent} {block:ifBorderAroundPermalinkMeta}border-meta{/block:ifBorderAroundPermalinkMeta} {block:ifPhotosStretchToFillWidth}photostretch{/block:ifPhotosStretchToFillWidth} {block:ifPhotosClickThroughToPermalink}photoclickthrough{/block:ifPhotosClickThroughToPermalink} {block:ifNotShowLikeAndReblogButtons}no-{/block:ifNotShowLikeAndReblog
View github-link-bookmarklet.js

DDL Lookup table:

commands nodeDriverHandle hasWriteConcern isExplicitlyWrite hasWriteAspect4.0 operationFile4.0 hasWriteAspect3.6 operationFile3.6
View ideas.js
class MongoOptions () {
static parse () {
// does all the parsing without async eg DNS checking operations
static performAsync () {
// follow up handler to check eg DNS (async) tasks
static parseAsync () {

Class Design Discussion

This is a document containg many different examples of how to create the same base code. Each example is different, contains a different API, or different added functionality such as cashing.

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 /
Last active Jul 1, 2020
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 {
View serviceState.ts
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
View Fox.ts
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>
View first-prophecy.ts
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;
You can’t perform that action at this time.