Skip to content

Instantly share code, notes, and snippets.

View ajeetkumarrauniyar's full-sized avatar
🏠
Working From Home

Ajeet Kumar ajeetkumarrauniyar

🏠
Working From Home
View GitHub Profile
@ajeetkumarrauniyar
ajeetkumarrauniyar / gist:d81ae6333b6ad7aa2d27df90720e7279
Created January 16, 2025 18:16
Sample DataSet Schema for Social Media Analytics Module
// src/models/Post.ts
import mongoose from 'mongoose';
const PostSchema = new mongoose.Schema({
postId: {
type: String,
required: true,
unique: true,
},
postType: {
```
node-assignment/
app.js
cluster.js
queue.js
task.js
logger.js
package.json
redis.conf
log.txt
@ajeetkumarrauniyar
ajeetkumarrauniyar / Chat App
Last active August 17, 2024 16:20
Chat App in TypeScript using
"use client";
import { FormEvent, useState } from "react";
interface IMessages {
message: string;
userId: string;
}
export default function Home() {
const [messages, setMessages] = useState<Array<IMessages> | undefined>([]);
<li className="message-item assistant-message-container">
<div className="assistant-message">
<div className="loading-animation">
<div className="loading-circle purple"></div>
<div className="loading-circle blue"></div>
<div className="loading-circle green"></div>
</div>
</div>
</li>
@ajeetkumarrauniyar
ajeetkumarrauniyar / Infinite Scroll of blogposts
Last active March 6, 2024 15:27
Infinite Scroll for Blog Posts
import React, { useState, useEffect } from 'react';
const PostList = () => {
const [posts, setPosts] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
const [hasMorePosts, setHasMorePosts] = useState(true);
useEffect(() => {
fetchInitialPosts();
}, []);
@ajeetkumarrauniyar
ajeetkumarrauniyar / Array CheatSheet.md
Last active November 25, 2025 14:40
Cheat sheet of Array methods in JavaScript

Array Methods Cheat Sheet

1. push()

  • Definition: Adds one or more elements to the end of an array and returns the new length of the array.
  • Syntax: array.push(element1[, ...[, elementN]])
  • Example:
    let arr = [1, 2, 3];
    arr.push(4, 5);

console.log(arr); // Output: [1, 2, 3, 4, 5]