Skip to content

Instantly share code, notes, and snippets.

View vmptk's full-sized avatar
🐉
Focusing

Venelin vmptk

🐉
Focusing
View GitHub Profile
# ---- Base Node ----
FROM mhart/alpine-node:10 AS base
# install node
RUN apk add --no-cache nodejs-current
# set working directory
WORKDIR /root/nextApp
# copy project file
COPY package.json .
COPY tsconfig.server.json .
COPY .npmrc .
@vmptk
vmptk / _app.tsx
Created March 30, 2020 04:19 — forked from immortalx/_app.tsx
nextjs withApollo _app
import { ApolloProvider } from '@apollo/react-hooks'
import App from 'next/app'
import React from 'react'
import withApolloClient from './lib/with-apollo-client'
class MyApp extends App {
render () {
const {Component, pageProps, apolloClient}: any = this.props
return(
<ApolloProvider client={apolloClient}>
@vmptk
vmptk / helm-cheatsheet.md
Created January 10, 2020 22:38 — forked from tuannvm/argo.md
#Helm #Kubernetes #cheatsheet, happy helming!
import io.opentracing.Scope;
import io.opentracing.ScopeManager;
import io.opentracing.Span;
import org.slf4j.MDC;
import org.springframework.lang.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class DiagnosticContextScopeManager implements ScopeManager {
import io.opentracing.Scope;
import io.opentracing.ScopeManager;
import io.opentracing.Span;
import org.slf4j.MDC;
import org.springframework.lang.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class DiagnosticContextScopeManager implements ScopeManager {
@vmptk
vmptk / SubscriptionHook.js
Created May 17, 2019 06:09 — forked from dabit3/SubscriptionHook.js
Example of using custom React hooks for managing GraphQL subscriptions
import { useEffect, useState } from 'react'
import { API, graphqlOperation } from 'aws-amplify'
const ListTalks = `
query {
listTalks {
items {
name
description
presenter {
@vmptk
vmptk / kafka-cheat-sheet.md
Created April 21, 2019 09:18 — forked from sahilsk/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
import React, { Component } from 'react';
import { graphql } from 'react-apollo';
import { gql } from 'graphql-tools';
const QUERY = gql`
query MatchesByDate($date: Int) {
matches(date: $date) {
id
minute
period
@vmptk
vmptk / Auth.js
Created March 4, 2019 23:11 — forked from lfades/Auth.js
Next.js Auth implementation: Apollo Server + Passport + Passport-jwt
/**
* server/dataSources/Auth.js
* Auth implementation, it's not really a dataSource so it doesn't need to be here
*/
const { authenticate, createJwt } = require('../lib/passport');
const { ON_HTTPS } = require('../configs');
const ONE_MINUTE = 1000 * 60;
const ONE_DAY = ONE_MINUTE * 60 * 24;
const ONE_MONTH = ONE_DAY * 30;
@vmptk
vmptk / index.test.js
Created September 11, 2017 21:22 — forked from RStankov/index.test.js
React test trick
// filename: components/CustomComponent/index.test.js
import React from 'react';
// Don't use component actual name, in this way
// when you rename the component, no test change is required
import Component from './index';
describe(Component.name, () => {
// Use SUD (system under test) component for the tests
// in this way each test contains only the props, specific to this test