Skip to content

Instantly share code, notes, and snippets.

View panoskouf's full-sized avatar

archived profile panoskouf

View GitHub Profile
@panoskouf
panoskouf / app.js
Created December 28, 2021 07:02 — forked from yowainwright/app.js
load images with Promises from MPJ
import loadImage from 'loadImage'
const addImg = (src) => {
const imgEl = document.createElement('img')
imgEl.src = src
document.body.appendChild(imgEl)
}
const imgArr = [
loadImage('images/cat1.jpg'),
loadImage('images/cat2.jpg'),
@panoskouf
panoskouf / vue.config.js
Created September 8, 2021 11:16 — forked from Akryum/vue.config.js
Per-page split chunks
module.exports = {
pages: {
pageA: 'src/pageA.js',
pageB: 'src/pageB.js',
pageC: 'src/pageC.js',
},
chainWebpack: config => {
const options = module.exports
const pages = options.pages
@panoskouf
panoskouf / .npmrc
Created August 23, 2021 08:38
npm 7 configuration variables
production_url=https://www.panoskouf.xyz
@panoskouf
panoskouf / typescript-types-generation-from-graphQL-schema.md
Last active August 13, 2021 07:13
typescript types generation from graphQL schema

npm i -D @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo @graphql-codegen/cli @graphql-codegen/add

then add codegen.yml to the project

overwrite: true
schema: "https://your.endpoint.com/graphql"
documents: "src/graphql/*.ts"
@panoskouf
panoskouf / apollo-client-gatsby.ts
Last active August 13, 2021 07:23
simple apollo client config for gatsby
import { ApolloClient, HttpLink, InMemoryCache, from } from "@apollo/client";
import { onError } from "@apollo/client/link/error";
import fetch from "cross-fetch";
const URI =
"https://https://your.endpoint.com/graphql";
const errorLink = onError(({ graphQLErrors, networkError }) => {
if (graphQLErrors) {
graphQLErrors.map(({ message, locations, path }) => {
@panoskouf
panoskouf / checkout to previous branch.txt
Created July 1, 2021 09:33
checkout to previous branch
git checkout - is a shorthand for git checkout @{-1}.
@panoskouf
panoskouf / getSvgs.sh
Last active December 14, 2021 14:20
grabbing svgs from exported sketch folder
#!/bin/bash
mkdir svgs
# add a second folder with name "social" in social and
# move all of its icons in there so they are 2 levels
# deep and get prefixed
# !!! This script does not handle files that end up
@panoskouf
panoskouf / ftb.sh
Last active June 14, 2021 08:46
destroy local changes of branch and make it same as remote
git fetch origin
git reset --hard origin/master
# Update @2020 (if you have main branch instead of master in remote repo)
git fetch origin
git reset --hard origin/main
# If you want to save your current branch's state before doing this (just in case), you can do:
@panoskouf
panoskouf / RenderComponents.vue
Last active June 4, 2023 12:10
vue 3 - Rendering components dynamically from json data
<template>
<component
v-for="comp in componentsArr"
:is="comp.is"
v-bind="comp.props"
:key="comp.key"
>
<div v-if="comp.slot">
<!-- calls itself - this is a recursive component -->
<render-components :componentsArr="comp.slot" />
@panoskouf
panoskouf / src_index.ts
Last active June 12, 2021 20:13
vue 3 - for component library - import all components globally example
/* component library - import all components globally example */
import SomeComponent from './components/SomeComponent'
import Notification from './components/notification'
import { App } from 'vue'
const components = {
SomeComponent,
Notification
// all components here