Skip to content

Instantly share code, notes, and snippets.

View officialrajdeepsingh's full-sized avatar
🏠
Working from home

Rajdeep Singh officialrajdeepsingh

🏠
Working from home
View GitHub Profile
@officialrajdeepsingh
officialrajdeepsingh / index.html
Created December 30, 2022 06:31
Create a TOC (table of content ) with javascript
<!DOCTYPE html>
<!-- saved from url=(0055)http://localhost:3000/how-to-install-deno-in-linux.html -->
<html class="" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>How to install deno in linux?</title>
@officialrajdeepsingh
officialrajdeepsingh / netlify_cms.js
Created November 15, 2022 08:02
netlify_cms config in javavscript
import f from "https://deno.land/x/netlify_cms_config@v0.2.0/mod.ts";
f.defaultRequired = false;
const config = {
backend: {
name: "git-gateway",
branch: "master",
},
media_folder: "images",
@officialrajdeepsingh
officialrajdeepsingh / card.njk
Created November 12, 2022 09:20
createtemplates/card.njk
<div class="container px-6 py-10 mx-auto">
<div class="mt-8 lg:-mx-6 lg:flex lg:items-center">
<img class="object-cover border-none w-full lg:mx-6 lg:w-1/2 rounded-xl h-72 lg:h-96" src="{{ post.data.image }}" alt="{{ post.data.title }}">
<div class="mt-6 lg:w-1/2 lg:mt-0 lg:mx-6 ">
<a class="text-sm text-blue-500 uppercase" href="/category/{{ post.data.category | category }}" >
{{ post.data.category | category }}
@officialrajdeepsingh
officialrajdeepsingh / og.tsx
Last active November 6, 2022 09:03
Nextjs OG Image is new functionality built on satori. Satori is a new library That converts HTML to png or SVG, and satori creates and maintains by vercel. OG Image Generation is lightweight and runs on vercel Edge.
// og.tsx
import { ImageResponse } from '@vercel/og';
import { NextRequest } from 'next/server';
// enable experimental edage
export const config = {
runtime: 'experimental-edge',
};
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html>
<Head>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
import '../styles/globals.css'
import Head from "next/head";
import Script from "next/script";
function MyApp({ Component, pageProps }) {
return (
<>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
@officialrajdeepsingh
officialrajdeepsingh / docker-compose.yml
Created October 15, 2022 11:45
docker-compose file for ghost cms
version: '3.8'
services:
blog:
image: ghost
restart: always
ports:
- 8080:2368
volumes:
- ./assets:/var/lib/ghost/content/themes/fastest/assets
- ./partials:/var/lib/ghost/content/themes/fastest/partials
@officialrajdeepsingh
officialrajdeepsingh / index.js
Created August 22, 2022 08:21
Auth of next-auth
// pages/index.js
import Login from '../components/login';
import { getProviders } from "next-auth/react"
import { unstable_getServerSession } from "next-auth/next"
import { authOptions } from "./api/auth/[...nextauth]";
export default function Home({ posts, Session , providers }) {
// pages/index.js
import Login from '../components/login';
import { useSession, getProviders } from "next-auth/react"
// rest import here
export default function Home({ posts, totalPostCount, providers }) {
// get session from next-auth
@officialrajdeepsingh
officialrajdeepsingh / Login.js
Last active August 22, 2022 07:44
Login component for next-auth
// components/login.js
import React from 'react'
import { signIn } from "next-auth/react"
export default function SignIn({ providers }) {
return (
<>
<div className="container mb-5">
<div className="col-md-6 mx-auto text-center">