Skip to content

Instantly share code, notes, and snippets.

@ratulkuri
ratulkuri / PRD.md
Created November 25, 2024 16:32
Project Requirements Document (PRD) Template

Project Requirements Document (PRD) Template

1. Project Overview

  • Project Name: [Insert Project Name]
  • Project ID: [Unique Identifier]
  • Date: [Date of Document Creation]
  • Version: [Version of the Document]
  • Prepared By: [Name(s) of the Author(s)]
  • Approved By: [Name(s) of Approvers]

Below is a table summarizing some common JavaScript array methods categorized into mutable (changing the original array) and immutable (returning a new array without modifying the original). The syntax is also provided for each method.

Method Mutable Immutable Syntax
Adding Elements
push() ✔️ ❌ array.push(item1, item2, ..., itemN)
unshift() ✔️ ❌ array.unshift(item1, item2, ..., itemN)
concat() ❌ ✔️ newArray = array.concat(item1, item2, ..., itemN)
...spread ❌ ✔️ newArray = [...array, item1, item2, ..., itemN]
Removing Elements
@ratulkuri
ratulkuri / .htaccess
Created September 26, 2023 08:05
Fix reload in inner pages gives 404 when react build project running in apache server
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
Method Runs through each item Executes Given Function Returns the result Number of elements in result
(compared to original array)
.map ✔ ✔ in array =
.filter ✔ ✔ if true, in array =<
.forEach ✔ ✔ no,
return is undefined
none
.reduce ✔ ✔ in array or anything else one,
(a single number or string)
Reduce transforms array into something else
for loop ✔ until condition is false,
you know the number of iteration beforehand
They run code blocks, They aren't functions so don't need to return >, = or <
while loop ✔ while condition is true, you don't know the number of iteration beforehand They run code blocks, They aren't functions so don't need to return >, = or <
<!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">
<title>Document</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@ratulkuri
ratulkuri / .htaccess
Created May 25, 2022 11:22
WordPress as subdirectory inside Laravel App
RewriteEngine On
RewriteCond $1 !^(blog)
@ratulkuri
ratulkuri / date_entobd.php
Last active May 30, 2020 23:18
Translate Dates English to Bangla in PHP
<?php
if(!function_exists("date_entobd")){
function date_entobd($date, $format = "l, F j, Y"){
$inputDate = date($format, strtotime($date));
$enDate = ['1','2','3','4','5','6','7','8','9','0','January','February','March','April',
'May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec','Saturday','Sunday',
'Monday','Tuesday','Wednesday','Thursday','Friday','Sat','Sun','Mon','Tue','Wed','Thu','Fri'];
@ratulkuri
ratulkuri / .htaccess
Created October 3, 2019 06:29
Laravel Root Directory Issue for Shared Hosting Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>