Skip to content

Instantly share code, notes, and snippets.

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

Prashant psahni

🏠
Working from home
View GitHub Profile
@psahni
psahni / express_server.js
Created February 19, 2025 08:35
simple express server
const express = require('express');
const path = require('path');
const app = express();
// Serve static files from the root directory
app.use(express.static(__dirname));
// Serve the index.html file
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'index.html'));
@psahni
psahni / next.js
Created January 25, 2025 08:54
next.js
|── Getting Started
| ├── Installation
| ├── Project Structure
| └── Basic Routing
|
|── Routing
| ├── Client-Side Routing
| ├── Server-Side Routing
| ├── Dynamic Routing
| ├── Internationalized Routing
@psahni
psahni / common_linux_commands
Created November 12, 2024 11:20
common_linux_commands
Linux commands - commonly used
𝗕𝗮𝘀𝗶𝗰𝘀:
`man` - Skim through manual for better understanding.
`nano` / `vim` - Use nano for basic editing, vim for advanced editing.
`ls -l` - List files with detailed info.
`ssh` - Connect to remote machines securely.
`df` / `du -hs *` - Check disk space usage.
`chown` / `chmod` - Change ownership and permissions of files.
`dig` - DNS lookup to find IPs of hostnames.
𝗘𝘃𝗲𝗿𝘆𝗱𝗮𝘆 𝗨𝘀𝗲:
@psahni
psahni / http_codes.md
Last active October 13, 2024 04:36
http codes

200 Success - Request completed.

201 Success - New resource created.

202 Success - The request has been accepted, but not yet processed.

204 Success - No content to return.

400 Bad Request - The request could not be parsed, generally due to bad syntax.

@psahni
psahni / denominations.go
Created September 17, 2024 14:29
denominations.go
package main
import (
"fmt"
"sort"
)
var notes = []int{1000, 500, 100}
@psahni
psahni / lazy_load.js
Created August 22, 2024 13:45
Lazy Load Images
document.addEventListener("DOMContentLoaded", function() {
var lazyloadImages = document.querySelectorAll("img.lazy");
var lazyloadThrottleTimeout;
function lazyload () {
if(lazyloadThrottleTimeout) {
clearTimeout(lazyloadThrottleTimeout);
}
lazyloadThrottleTimeout = setTimeout(function() {
@psahni
psahni / node.js.md
Last active August 31, 2024 09:46
node syllabus

Episode-01

Introduction to NodeJS

Discover NodeJS:

a powerful tool for running JavaScript on the server. Learn its basics and why it's a game-changer.

Episode-02

@psahni
psahni / design_patterns.md
Last active August 16, 2024 13:08
Design Patterns

Factory Pattern

// Factory Pattern
pf: = ProductFactory{}
pf.createProduct("jeans")


// Product is interface 

createProduct(type string) Product {
@psahni
psahni / docker-compose-wp-mysql.yml
Created June 10, 2024 07:55
docker-compose-example-wp-mysql
version: '3'
services:
db:
container_name: wp-mysql
image: mysql:5.7
volumes:
- $PWD/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 12345678
@psahni
psahni / .gitlab-ci.yml
Created May 18, 2024 14:20
gitlab_cicd_example
image: node:10
stages:
- build
- test
- deploy review
- deploy staging
- deploy production
- production tests