Skip to content

Instantly share code, notes, and snippets.

View Mando75's full-sized avatar
🤖
Meaningless [C]ode

Bryan Müller Mando75

🤖
Meaningless [C]ode
View GitHub Profile
@Mando75
Mando75 / suspended-execution.ts
Last active August 28, 2022 23:29
Suspended Execution using generator example
type ValidatorGenerator = AsyncGenerator<Error, number>
type OperationGenerator = AsyncGenerator<ValidatorGenerator, { num: number }, number>
/**
* This function yields an Error if the input is invalid
* or returns the data if it is ok
* @param number
*/
function* validator(number: number): ValidatorGenerator {
if (number % 2 === 0) {
def find_ravi_pairs_in_bound(n)
ravis = []
# Just setting an upper bound on this for now
(1..(n/2)).each do |i|
(i..n).each do |j|
# Add the two numbers together and convert them to binary string
a = (i + j).to_s(2)
# Multiply the two numbers together and convert them to binary string
b = (i * j).to_s(2).reverse
# just working with the upper bound
@Mando75
Mando75 / PaginationHelper.ts
Last active March 7, 2020 23:44
An example PaginationHelper for typeorm graphql loader
import { FieldNode, GraphQLResolveInfo, SelectionNode } from "graphql";
import { GraphQLDatabaseLoader } from "@mando75/typeorm-graphql-loader";
import { SearchOptions, FeedNodeInfo } from "@mando75/typeorm-graphql-loader/dist/types";
import { LoaderSearchMethod } from "@mando75/typeorm-graphql-loader/dist/base";
import { OrderByCondition } from "typeorm";
type getFeedOptions = {
search?: SearchOptions;
order?: OrderByCondition;
};

Keybase proof

I hereby claim:

  • I am mando75 on github.
  • I am bmullersn (https://keybase.io/bmullersn) on keybase.
  • I have a public key ASBLfZ8v5fg1foZge5ZpnBPDfdd2jx2Ha7y8litvo_vwhwo

To claim this, I am signing this object:

@Mando75
Mando75 / Example.vue
Created October 10, 2019 21:55
Vue GraphQL infinite scroll with VueApollo and vue-infinite-loading
<template>
<section>
<div v-if="guidePlayerFeed">
<v-fade-transition class="row" group tag="div">
<v-col
v-for="(player, index) in guidePlayerFeed.players"
:key="player.id + index"
cols="12"
sm="6"
md="4"
@Mando75
Mando75 / BaseEntity.ts
Created May 7, 2019 03:50
GraphQL Dataloader factory TypeORM Example
import { BaseEntity as typeOrmEntity, ObjectType } from "typeorm";
import { ObjectUtils } from "typeorm/util/ObjectUtils";
import * as DataLoader from "dataloader";
// Creating our own BaseEntity Class...
export class BaseEntity extends typeOrmEntity {
id: string;
constructor() {
super();
}
@Mando75
Mando75 / spacemacs.el
Created March 4, 2019 05:36
Spacemacs init with prettier
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
function sendAlert(employee, date, vLog) {
var message = ("<head><style>"
+" @import url('https://fonts.googleapis.com/css?family=Work+Sans');"
+" #main {"
+" font-family: 'Work Sans', sans-serif;"
+" font-size: 14pt;"
+" padding: 1em; "
+" max-width: 600px"
+" }"
+" div#header {"