Skip to content

Instantly share code, notes, and snippets.

View Narottam04's full-sized avatar

Narottam Sahu Narottam04

View GitHub Profile
@Narottam04
Narottam04 / index.html
Created November 26, 2022 13:25
Mediapipe hands is not working on iOS. Seems to work on all other platforms like windows, android
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- css -->
<link rel="stylesheet" href="/css/styles.css" ></link>
<!-- mediapipe and tensorflow library -->
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
@Narottam04
Narottam04 / AuthContext.js
Last active December 18, 2021 06:12
Error while deleting the account in gun js
function deleteAccount(){
//username and password is stored in authcontext
user.delete(username,userPassword,({ok})=> {
if(ok){
router.push('/')
setUsername('');
setUserPassword('')
}
else{
alert('There was a problem deleting your account')
@Narottam04
Narottam04 / AuthContext.js
Last active December 17, 2021 10:42
Problem: How to implement unique username feature in gun js
import {useContext, useEffect,useState,createContext} from 'react'
import GUN from 'gun'
import 'gun/sea'
import 'gun/axe'
const AuthContext = createContext()
export function useAuth() {
return useContext(AuthContext)
}
@Narottam04
Narottam04 / Header.js
Created August 22, 2021 13:25
React Resume maker
// example where i am using this editable p tag
import React,{useState} from 'react'
import Text from './Text';
const Header = () => {
// i want to grab the data from this text file and append it as an object so that i can store it to database later on
@Narottam04
Narottam04 / .eleventy.js
Last active July 4, 2021 11:58
11ty Collection for Image files not working
// Import fast-glob package
const fg = require('fast-glob');
module.exports = config => {
config.addPassthroughCopy('./src/images/');
const BASE_DIR = "images/aquapolis";
config.addCollection("images", () => fg.sync(`${BASE_DIR}/**/*.{jpg,png,gif}`));
return {
markdownTemplateEngine: 'njk',
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("images");
eleventyConfig.addPassthroughCopy("admin");
eleventyConfig.addPassthroughCopy("CSS");
eleventyConfig.addPassthroughCopy("Javascript");
eleventyConfig.addPassthroughCopy("manifest.webmanifest");
eleventyConfig.addPassthroughCopy("sw.js");
eleventyConfig.addPassthroughCopy(".well-known");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("images");
eleventyConfig.addPassthroughCopy("admin");
eleventyConfig.addPassthroughCopy("CSS");
eleventyConfig.addPassthroughCopy("Javascript");
eleventyConfig.addWatchTarget("images");
eleventyConfig.addWatchTarget("admin");
eleventyConfig.addWatchTarget("CSS");
eleventyConfig.addWatchTarget("Javascript");
@Narottam04
Narottam04 / posts.njk
Last active April 30, 2021 17:47
Pagination not working. No errors when compiling.
---
layout: layouts/allposts.njk
permalink: '/posts{% if pagination.pageNumber > 0 %}/page/{{ pagination.pageNumber }}{% endif %}/index.html'
title: My Posts
pagination:
data: collections.posts
size: 3
reverse: true
---