Skip to content

Instantly share code, notes, and snippets.

View thisismydesign's full-sized avatar

Csaba Apagyi thisismydesign

View GitHub Profile
@thisismydesign
thisismydesign / google-oauth.controller.ts
Last active March 19, 2024 19:08
OAuth2 in NestJS for social login (Google, Facebook, Twitter, etc) /1
import { Controller, Get, Req, Res, UseGuards } from '@nestjs/common';
import { Request, Response } from 'express';
import { GoogleOauthGuard } from './google-oauth.guard';
@Controller('auth/google')
export class GoogleOauthController {
constructor(private jwtAuthService: JwtAuthService) {}
@Get()
@UseGuards(GoogleOauthGuard)
@thisismydesign
thisismydesign / package.json
Last active September 6, 2023 12:47
Typed GraphQL queries and results /2 Generate types
{
"scripts": {
"client:generate:schema": "zeus <path-ot-schema> <output-folder> --typescript --apollo"
}
}
@thisismydesign
thisismydesign / grpahql-client.ts
Last active March 27, 2022 19:47
Typed GraphQL queries and results /2 Typed client
import { ApolloClient, gql, InMemoryCache, QueryOptions } from '@apollo/client';
import {
Zeus,
ValueTypes,
ModelTypes,
GraphQLTypes,
InputType,
} from './types/zeus';
@thisismydesign
thisismydesign / install.sh
Last active March 27, 2022 12:48
Typed GraphQL queries and results /1 Install
yarn add --dev graphql-zeus
@thisismydesign
thisismydesign / .eslintrc.js
Last active September 6, 2023 12:43
NestJS + Next.js /4 Folder structure & config
// src/client/.eslintrc.js
// Your custom ESLint file for React, applied only to src/client automatically
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'src/client/tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
@thisismydesign
thisismydesign / home.tsx
Last active September 6, 2023 12:46
NestJS + Next.js /3 Home page
import React from 'react';
import { NextPage } from 'next';
const Home: NextPage = () => {
return <h1>Hello from NextJS! - Home</h1>;
};
export default Home;
@thisismydesign
thisismydesign / view.controller.ts
Last active January 8, 2024 06:57
NestJS + Next.js /2 View Module
import { Controller, Get, Res, Req } from '@nestjs/common';
import { Request, Response } from 'express';
import { parse } from 'url';
import { ViewService } from './view.service';
@Controller('/')
export class ViewController {
constructor(private viewService: ViewService) {}
@thisismydesign
thisismydesign / install.sh
Last active September 6, 2023 12:44
NestJS + Next.js /1 Install
yarn add next react react-dom
yarn add --dev @types/react @types/react-dom
@thisismydesign
thisismydesign / example data
Last active September 6, 2023 12:44
NestJS Google OAuth
this.oauth2Client.getTokenInfo(
req.user.accessToken,
);
tokenInfo {
web_1 | expiry_date: 1619210156644,
web_1 | scopes: [
web_1 | 'https://www.googleapis.com/auth/userinfo.email',
web_1 | 'https://www.googleapis.com/auth/userinfo.profile',
web_1 | 'openid'
web_1 | ],
@thisismydesign
thisismydesign / README.md
Created December 11, 2019 13:20
Ruby docker image and bundler version

Ruby's docker images (e.g. ruby:2.6.3) use bundler v1 (e.g. 1.17.3), see: docker-library/ruby#268 (comment)

When bundling with bundler v2 locally it can lead to the the following exception:

Could not find 'bundler' (2.0.2) required by your /app/Gemfile.lock. (Gem::GemNotFoundException)

Solve this by using the correct bundle version locally:

gem install bundler -v 1.17.3