Skip to content

Instantly share code, notes, and snippets.

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

Vipul vipulbhj

🏠
Working from home
View GitHub Profile
@vipulbhj
vipulbhj / index.js
Created November 23, 2018 18:49
Basic Node JS server using http module.
const http = require('http');
const PORT = process.env.PORT || 5000;
const app = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write("Hello World");
res.end();
});
@vipulbhj
vipulbhj / index.js
Last active November 23, 2018 19:46
Routing Module.
const http = require('http');
const fs = require('fs');
// All the routes are defined here.
const router = [
{
'url': '/',
'fn': (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
@vipulbhj
vipulbhj / symbol.js
Created March 23, 2019 19:01
For the Symbols blog
const sym1 = Symbol();
const sym2 = Symbol();
sym1 === sym2;
// false
const sym3 = Symbol.for("cat");
const sym4 = Symbol.for("cat");
sym3 === sym4;
let arr = [
{
firstName: 'Jon',
lastName: 'Doe'
},
{
firstName: 'example',
lastName: 'example'
},
{
let arr1 = [1, 2, 4, 5];
let arr2 = array1;
arr1 = [];
console.log(arr2);
// -> Output [1, 2, 4, 5];
let arr1 = [1, 2, 4, 5];
let arr2 = arr1;
arr1 = [];
console.log(arr2);
// -> Output [1, 2, 4, 5];
let arr1 = [1, 2, 4, 5];
let arr2 = arr1;
arr1.length = 0;
console.log(arr2); // Output :- []
@vipulbhj
vipulbhj / expr.s
Created May 20, 2026 18:00
Expression Evaluator
.global _main
.text
parse_num:
mov x1, #0
1:
ldrb w2, [x0]
cmp w2, #'0'
blt 2f
@vipulbhj
vipulbhj / expr-eval.s
Created May 26, 2026 03:47
A simple expression evaluator written in AArch64 ARM assembly for MacOS
; ==============================================================================
; ARCHITECTURE & SYMBOL DEFINITIONS
; ==============================================================================
.global _main
.extern _printf ; (New: Import standard C printf function)
.align 3 ; Clamp all structures onto high-performance 8-byte boundaries
; --- TOKEN IDENTIFIERS ---
.equ TOK_NUMBER, 1
.equ TOK_ADD, 2