Skip to content

Instantly share code, notes, and snippets.

View devmnj's full-sized avatar
💭
Exploring Algos

Manoj AP devmnj

💭
Exploring Algos
View GitHub Profile
@devmnj
devmnj / slice-rnderring.vue
Created June 26, 2021 05:42
Custom Prismic slice rendering in Nuxtjs
<template>
<div class="container">
<div class="flex">
<slice-zone class="subtitle"
:slices="page.data.body1"
:resolver="resolver" />
</div>
</div>
</template>
@devmnj
devmnj / prismic-vue-store.js
Created June 26, 2021 05:46
Prismic-CMS-Nuxt store example
export const state = () => ({
snippets: Object,
isLoaded: false,
})
export const actions = {
async loadSnippets({ commit }) {
const document = await this.$prismic.api.query(
this.$prismic.predicates.at("document.type", "snippet_type")
);
@devmnj
devmnj / Vue-analytic.js
Created July 7, 2021 11:48
Vue GA plugin using vue-gtag in nuxt for monitoring site traffic
import Vue from "vue";
import VueGtag from "vue-gtag";
Vue.use(VueGtag, {
config: { id: process.env.GID}, //measurement ID G-LL1HBDMH8D,
params: {
send_page_view: false
}
});
@devmnj
devmnj / index.js
Created July 10, 2021 13:26
Keystone CMS authentication in Nuxtjs
const { Keystone } = require('@keystonejs/keystone');
const { Password, Text, Relationship, Checkbox } = require('@keystonejs/fields');
const { GraphQLApp } = require('@keystonejs/app-graphql');
const { AdminUIApp } = require('@keystonejs/app-admin-ui');
const { NuxtApp } = require('@keystonejs/app-nuxt');
const { MongooseAdapter: Adapter } = require('@keystonejs/adapter-mongoose');
const PROJECT_NAME = 'key-app';
const adapterConfig = { mongoUri: 'mongodb://localhost/key-app' };
const { PasswordAuthStrategy } = require('@keystonejs/auth-password')
@devmnj
devmnj / strapi
Created July 15, 2021 12:13
Run Strapi project in Docker
// Run the following command in terminal
// This example based on Windows
docker run -it -p 1337:1337 -v e:\projec-name :/srv/app strapi/strapi
@devmnj
devmnj / gist:9bb766a757b9bfe06d0d61137508a5d8
Last active September 21, 2021 14:44
GitHub repo remote hang up error fix
//run the line in shell and try to push repo again
git config --global http.postBuffer 157286400
git config --global http.postBuffer 524288000
git push -u origin master
//
@devmnj
devmnj / nuxt_sitemap.sj
Created July 17, 2021 17:13
Nuxt dynamic route sitemap
const Prismic = require('@prismicio/client');
...
modules: [
'@nuxtjs/sitemap'
],
sitemap: {
hostname: process.env.sitemap_host,
cacheTime: 1000 * 60 * 60 * 2,
trailingSlash: true,
@devmnj
devmnj / nuxt_sitemap.sj
Created July 17, 2021 17:13
Nuxt dynamic route sitemap
const Prismic = require('@prismicio/client');
...
modules: [
'@nuxtjs/sitemap'
],
sitemap: {
hostname: process.env.sitemap_host,
cacheTime: 1000 * 60 * 60 * 2,
trailingSlash: true,
@devmnj
devmnj / graphql.js
Created July 25, 2021 03:45
Nextjs appolo graphql api - fix
//apply this fix where regular method fails
import { gql, ApolloServer } from "apollo-server-micro";
import { PrismaClient } from "@prisma/client";
import {
ApolloServerPluginLandingPageGraphQLPlayground,
ApolloServerPluginLandingPageDisabled,
} from "apollo-server-core";
const prisma = new PrismaClient();
@devmnj
devmnj / graphql.ts
Last active July 26, 2021 15:18
Create Nuxt apollo-graphql server with Apollo, Express, and Prisma using serverMiddleware
/* Create a folder , api/graphql.ts (root of peoject) and paste the following code*/
const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
const {PrismaClient} = require("@prisma/client")
const prisma = new PrismaClient();
const typeDefs = gql`
type Todo{