Skip to content

Instantly share code, notes, and snippets.

View Vivek205's full-sized avatar
🏎️

Vivek Vivek205

🏎️
  • Travix
  • Amsterdam, Netherlands
View GitHub Profile
@Vivek205
Vivek205 / tasks.controller.ts
Last active October 4, 2022 11:35
Task controller to map the service handlers for the http methods
import {
Body,
Controller,
Delete,
Get,
Param,
Patch,
Post,
Query,
} from '@nestjs/common';
@Vivek205
Vivek205 / app.module.ts
Created October 4, 2022 11:28
The root module of the application
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { TasksModule } from './tasks/tasks.module';
@Module({
imports: [
TasksModule,
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
@Vivek205
Vivek205 / main.ts
Created October 4, 2022 11:22
NestJs sample app; entry file
import { ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(
new ValidationPipe({
validationError: {
value: true,
@Vivek205
Vivek205 / ghcup.sh
Created July 16, 2021 05:27
Install Haskell
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
@Vivek205
Vivek205 / index.html
Created March 4, 2021 05:57
External fonts
<link href="https://fonts.googleapis.com/css?family=Space+Mono:400,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Space+Mono:400,700&display=swap" rel="preload" as="font">
@Vivek205
Vivek205 / index.html
Created March 4, 2021 05:49
Preconnect and DNS Prefetch
<link rel="dns-prefetch" href="//static.hotjar.com">
<link rel="dns-prefetch" href="//www.google-analytics.com">
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
@Vivek205
Vivek205 / imageLazyLoading.jsx
Created March 4, 2021 05:24
imageLazyLoading.js
const GifContainer = ({ classes, content }) => {
return (
<img
src={content}
alt="Demo Gif File"
className={classes.FullWidth}
loading="lazy"
/>
);
};
@Vivek205
Vivek205 / BookService.js
Created February 29, 2020 11:57
Executing BookService gRPC
import { grpc } from "@improbable-eng/grpc-web";
import { BookService } from "./Book_pb_service";
parseGetBookMessage = message => {
// parse the binary response back to appropriate type described in the proto
const book = {
isbn: message.getIsbn(),
title: message.getTitle(),
author: message.getAuthor()
};
@Vivek205
Vivek205 / Book_pb.js
Last active February 29, 2020 11:32
Generated Stub Files
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
@Vivek205
Vivek205 / Book.proto
Last active February 29, 2020 11:29
Sample Proto
syntax = "proto3";
package com.book;
message Book {
int64 isbn = 1;
string title = 2;
string author = 3;
}