Skip to content

Instantly share code, notes, and snippets.

View kandros's full-sized avatar
:bowtie:
o.o

Jaga Santagostino kandros

:bowtie:
o.o
View GitHub Profile
@kandros
kandros / typescriptreact.json
Created April 6, 2022 11:14
typescriptreact vscode snippets
{
"functional component": {
"prefix": ["func, fnc", "component", "fc", "func"],
"description": "react functional component",
"body": [
"import React from 'react'",
"type Props = {}",
"export const $TM_FILENAME_BASE: React.FC<Props> = () => {",
"\treturn (",
"\t\t<div>",
@kandros
kandros / Dockerfile
Created April 21, 2021 22:37
Fastify TypeScript Dockerfile
FROM node:14-alpine as builder
WORKDIR /app
ENV NODE_ENV=production
COPY package.json package-lock.json tsconfig.json ./
COPY src ./src
RUN npm ci --also=dev
RUN npm run build:ts
RUN npm prune --production
@kandros
kandros / .dockerignore
Last active December 17, 2020 09:10
Dockerfile for next.js projects
e2e
fixtures
*.test.*
node_modules
.next
.env
Dockerfile
.git
@kandros
kandros / _app.tsx
Created September 2, 2020 12:19
NextJS cognito cookie redirect to login
import { UserProvider } from "@app/context/user-context"
import "@app/styles/font.css"
import "@app/styles/global.css"
import "@app/styles/reset.css"
import { NextComponentType } from "next"
import App, { AppContext, AppInitialProps, AppProps } from "next/app"
import Head from "next/head"
import { parseCookies } from "nookies"
const CustomApp: NextComponentType<AppContext, AppInitialProps, AppProps> = ({ Component, pageProps }) => {
@kandros
kandros / gatsby-node.js
Created March 31, 2020 17:37
gatsby blog next prev
const path = require(`path`)
const { createFilePath } = require(`gatsby-source-filesystem`)
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const blogPost = path.resolve(`./src/templates/blog-post.js`)
const postsPromise = graphql(
`
{
document.addEventListener("keydown", e => {
if (e.key === "f") {
const btn = document.querySelector(
"#vjs_video_3 > div.playlist-arrow-button.hover-button"
);
btn.click();
} else if (e.code === "Space") {
e.preventDefault();
const video = document.querySelector("#vjs_video_3_html5_api");
@kandros
kandros / history
Last active July 3, 2019 12:06
Working Software
const paymentMachine = Machine({
id: 'payment',
initial: 'method',
states: {
method: {
initial: 'cash',
states: {
cash: { on: { SWITCH_CHECK: 'check' } },
check: { on: { SWITCH_CASH: 'cash' } },
hist: { type: 'history' }
@kandros
kandros / gatsby-ssr.js
Last active May 5, 2019 10:46
add simpleanalytics.com to gatsby
const React = require("react")
exports.onRenderBody = ({ setPostBodyComponents }) => {
if (process.env.NODE_ENV !== `production`) {
return null
}
return setPostBodyComponents([
<script
key="simpleanalytics"
async

Keybase proof

I hereby claim:

  • I am kandros on github.
  • I am jagasantagostino (https://keybase.io/jagasantagostino) on keybase.
  • I have a public key whose fingerprint is 6DDD E439 6C25 671A 477A 9687 69BC E331 BD9E 8B66

To claim this, I am signing this object:

# somewhere in schema definition
type User {
name: String!
lastname: String!
fullname: String!
}
// somewhere in server code