Skip to content

Instantly share code, notes, and snippets.

View RS2007's full-sized avatar
🐧

Rohith Suresh RS2007

🐧
View GitHub Profile
@RS2007
RS2007 / index.ts
Created January 29, 2026 14:25
Declarator parser and type resolver
type Cursor = {
source: string;
index: number;
};
export type IdentifierNode = {
kind: "identifier";
name: string;
};
@RS2007
RS2007 / serverRenderer.js
Created March 22, 2025 13:09
Server rendering a component using babel and react
// src/server/render.js
import React from 'react';
import { renderToString } from 'react-dom/server';
import fs from 'fs';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
/**
@RS2007
RS2007 / SkipListMap.ts
Created February 6, 2025 13:38
Implementation of an associative array/map using skiplists
// Public interface
interface SkipList<K, V> {
insert(key: K, value: V): void;
get(key: K): V | undefined;
}
// Internal types
type ExtendedKey<K> =
| { type: "NegativeInfinity" }
| { type: "PositiveInfinity" }
class SLNode {
value: number;
constructor(value: number) {
this.value = value;
}
}
class SLNodeSet {
private levels: (SLNode | null)[][];
@RS2007
RS2007 / Main.java
Created October 25, 2024 04:49
Demo of cas and threads in java
import java.util.concurrent.atomic.AtomicInteger;
import java.util.ArrayList;
class Main {
public static void main(String[] args) {
ArrayList<Integer> wrapInt = new ArrayList<>();
AtomicInteger lock = new AtomicInteger(0);
wrapInt.add(0);
ArrayList<Thread> threads = new ArrayList<>();
for(int i = 0; i < 5; i++){