Skip to content

Instantly share code, notes, and snippets.

View surajbera's full-sized avatar

Suraj S. Bera surajbera

  • Mumbai
  • 16:19 (UTC -12:00)
View GitHub Profile
@surajbera
surajbera / use-effect-timer-readme.md
Created June 7, 2026 03:00
useEffect timer readme

useEffect Countdown Notes

This note explains the following code and answers the question about when useEffect runs.

The Original Code

useEffect(() => {
  const intervalId = setInterval(() => {
 setTimeLeft(timeLeft - 1);
from dotenv import load_dotenv
from openai import OpenAI
import json
import requests
load_dotenv()
client = OpenAI() # automatically reads OPENAI_API_KEY from .env
# ---------- TOOL FUNCTION ----------
@surajbera
surajbera / few-shot-prompting.py
Last active May 4, 2026 10:51
simplest code in python for few-shot-prompting
import os
from openai import OpenAI
from dotenv import load_dotenv
load_dotenv()
client = OpenAI()
SYSTEM_PROMPT = """
You are a helpful assistant. You only help with Python programming questions and nothing else.
If user tried to ask you about something else, you should politely decline and say you only help
@surajbera
surajbera / grids.scss
Last active December 5, 2024 02:55
Grid Layout CSS
$gutter-vertical: 30px; // Adjust the value as needed for your design
$gutter-horizontal: 30px; // Adjust the value as needed for your design
@mixin clearfix {
&::after {
content: "";
display: table;
clear: both;
}
}