Skip to content

Instantly share code, notes, and snippets.

<template>
<form class="q-pa-lg">
<q-input v-model="blogTitle" class="q-ma-lg" filled label="Title" />
<q-card flat bordered class="q-ma-lg">
<q-editor
min-height="5rem"
:placeholder="storyPlaceholder"
v-model="blogContent"
/>
</q-card>
<template>
<q-layout view="lHh Lpr fff" class="bg-grey-1">
<q-header elevated class="bg-white text-grey-8" height-hint="64">
<q-toolbar class="GNL__toolbar">
<q-btn
flat
dense
round
@click="toggleLeftDrawer"
aria-label="Menu"
@divyasonaraa
divyasonaraa / index.js
Last active November 26, 2023 17:36
index.js
/* dependancies*/
const express = require("express");
const cors = require("cors");
const { initializeApp, cert } = require("firebase-admin/app");
const {
getFirestore,
Timestamp,
FieldValue,
} = require("firebase-admin/firestore");
const busboy = require("busboy");
@divyasonaraa
divyasonaraa / MainLayout-script.vue
Last active November 29, 2023 05:16
Home Screen Installation
<template>
<q-footer elevated reveal class="bg-grey-8" bordered>
<div class="constrain">
<q-banner
inline-actions
dense
class="bg-grey-8 text-white"
v-if="showInsatllbanner"
>
<b>Install Blogify? </b>
//Cache first, falling back to network
registerRoute(
({ url }) => url.host.startsWith("fonts.googleapi.com"),
new CacheFirst({
cacheName: "google-fonts",
plugins: [
new ExpirationPlugin({
maxEntries: 30,
}),
new CacheableResponsePlugin({
import { Queue } from "workbox-background-sync";
let backgroundSync = "sync" in self.registration ? true : false;
/*
queue- create post
*/
let createBlogQueue = null;
if (backgroundSync) {
createBlogQueue = new Queue("createBlogQueue", {
if (!navigator.onLine && isBackgroundSyncSupported.value) {
// Notify user about successful blog creation
$q.notify({
message: "Offline Blog Created Successfully!",
type: "positive",
timeout: 2000,
});
// Redirect to the home page
router.push("/");
<template>
//rest of the code
<q-card
class="my-card q-ma-lg"
:class="{ 'bg-red-1': blog.offline }"
flat
bordered
v-for="blog in blogList"
:key="blog.key"
@click="redirectToBlog(blog.id)"
<script setup>
//imports
import { useRouter } from "vue-router";
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
//variables
const router = useRouter();
const showInsatllbanner = ref(false);
const leftDrawerOpen = ref(false);
let webpush = require("web-push");
const publicKey =
"Your-public-key";
const privateKey = "Your-private-key";
/*
config - webpush