Skip to content

Instantly share code, notes, and snippets.

View kevinvdburgt's full-sized avatar
😼
Cat's are great!

Kevin van der Burgt kevinvdburgt

😼
Cat's are great!
View GitHub Profile
export const AuthProvider: FunctionComponent<AuthProviderProps> = (props) => {
const { children } = props;
const [token, setToken] = useLocalStorage<string | null>({
key: 'auth.token',
defaultValue: null,
getInitialValueInEffect: true,
});
const [user, setUser] = useLocalStorage<UsersMeResponse | null>({
const simulateSlowHttpRequest = async (dummyData: string): Promise<string> =>
new Promise<string>((resolve) => setTimeout(() => resolve(dummyData), 2000));
const bootstrap = async (): Promise<void> => {
/**
* Test A
*/
const startA = Date.now();
const aA = await simulateSlowHttpRequest('a');
// modules/example/interfaces/listing.interface.ts
export interface ListingInterface {
names: string[];
}
// modules/example/dtos/listing.dto.ts
export class ListingPayloadDto implements ListingInterface {
// class-validator validations
// @nestjs/swagger decorators
readonly names!: string[];
{
"products": [
{
"uuid": "bd24626d-a078-403d-ae5e-6df5d9690908",
"name": "Minecraft Server (Modded)"
},
{
"uuid": "d8721919-a652-462b-95ac-b276db1412fb",
"name": "WordPress"
},
@kevinvdburgt
kevinvdburgt / prisma.service.ts
Created January 15, 2021 10:33
Prisma service using knex migrations.
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
import knex from 'knex';
import knexfile from './knexfile';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
/**
* Waits for the database to be available.
*/
const bootstrap = async (): Promise<void> => {
// Do stuff
});
bootstrap().catch((error: Error) => {
// Send error to sentry or Slack
console.error(error);
});
@kevinvdburgt
kevinvdburgt / keybinds.md
Last active February 21, 2019 20:42
Play Rust - Keybinds

Keybinds for the game Rust

Press Q to auto-run, press Shift and W to cancel.

bind q forward;sprint

Press Z to permanently crouch and auto-attack, press Left Click and Control to cancel.

bind z attack;duck

Hold Z to crouch and auto-attack (only while pressed.)

bind z +attack;+duck

#!/bin/bash
WORKSPACE=$1
log() {
echo "[$(date +"%D %T")] $1" >> "$WORKSPACE/deployment.log"
echo $1
}
# Check if the workspace directory exists
breakBlock = (block) => {
return new Promise((resolve, reject) => {
// @TODO: Equip the right tool
this.bot.dig(block, (err) => {
if (err) {
return reject(err);
}
return resolve();
@kevinvdburgt
kevinvdburgt / Dockerfile
Created May 30, 2018 13:22
Dockerfile Laravel
FROM php:7.2.0-fpm-alpine3.7
LABEL maintainer = "Kevin van der Burgt <kevin@zdev.com>"
# Change the workdirector
WORKDIR /var/www
# Copy the vendor listing files
COPY composer.* package* /var/www/
# Copy the database files, the composer installer requires some parts to exists