Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
o.o

Jaga Santagostino kandros

:bowtie:
o.o
View GitHub Profile
@kandros
kandros / .dockerignore
Last active Dec 17, 2020
Dockerfile for next.js projects
View .dockerignore
e2e
fixtures
*.test.*
node_modules
.next
.env
Dockerfile
.git
@kandros
kandros / _app.tsx
Created Sep 2, 2020
NextJS cognito cookie redirect to login
View _app.tsx
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 Mar 31, 2020
gatsby blog next prev
View gatsby-node.js
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(
`
{
View skillshare-custom-keybinding
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 Jul 3, 2019
Working Software
View history
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
add simpleanalytics.com to gatsby
View gatsby-ssr.js
const React = require("react")
exports.onRenderBody = ({ setPostBodyComponents }) => {
if (process.env.NODE_ENV !== `production`) {
return null
}
return setPostBodyComponents([
<script
key="simpleanalytics"
async
View keybase.md

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:

View gist:4528fa21d589f443620a1c1834616872
# somewhere in schema definition
type User {
name: String!
lastname: String!
fullname: String!
}
// somewhere in server code
View testing-example.js
// Traccia:
// Crea una funzione che prende come parametri 2 numeri e li somma e ritorna il risultato
function myFunc(x, y) {
return x + y
}
function test() {
let result = myFunc()
@kandros
kandros / launch.json
Created Apr 17, 2018
debug current file in VSCODE
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}"
}
],
You can’t perform that action at this time.