Skip to content

Instantly share code, notes, and snippets.

View rajeshpillai's full-sized avatar

Rajesh Pillai rajeshpillai

View GitHub Profile
@rajeshpillai
rajeshpillai / cache.js
Last active March 18, 2025 10:39
Redis Cache for Node.js
// cache/baseCache.js
// This is our abstract base class defining the contract for our cache implementations.
class BaseCache {
async get(key) {
throw new Error('Method "get" must be implemented');
}
async set(key, value, ttl) {
throw new Error('Method "set" must be implemented');
}
console.clear();
function html(strings, ...values) {
// Combine the strings and values into a single string
const combined = strings.reduce((acc, str, i) => acc + str + (values[i] !== undefined ? `§${i}§` : ''), '');
console.log({combined});
// Create a temporary container to hold the HTML string
const container = document.createElement('div');
@ashraf2047
ashraf2047 / IDE.js
Last active September 10, 2022 02:10
// The layout of the windows in the IDE.
this.windowGrid = [
[new FileWindow(), new NoteWindow()],
[new TerminalWindow()],
];
const getWindow = (window) => {
let component;
switch (window.type) {
case constants.NOTE:
@LewisGaul
LewisGaul / zig-blog-posts.md
Last active August 10, 2025 13:50
Collection of blog posts about the Zig programming language
@Sherex
Sherex / wikijs-keycloak-config-guide.md
Last active June 20, 2025 01:33
A guide for configuring Keycloak as a authentication provider in WikiJS | https://wiki.js.org | Feature request for adding this to the docs: https://requarks.canny.io/wiki/p/keycloak-auth-docs-proposal-for-a-guide-written
@saitonakamura
saitonakamura / fixCircular.js
Last active October 27, 2021 03:29
Function that replace circular js object dependency with "[Circular]" so it can be consumed by JSON.stringify
// DISCLAIMER
// Original function was updated to a faster and es5-supporting version by @Quacky2200
var replaceCircular = function(val, cache) {
cache = cache || new WeakSet();
if (val && typeof(val) == 'object') {
if (cache.has(val)) return '[Circular]';
@seanjensengrey
seanjensengrey / octal_x86.txt
Last active July 9, 2025 04:26
x86 is an octal machine
# source:http://geocities.com/SiliconValley/heights/7052/opcode.txt
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@matthewjberger
matthewjberger / instructions.md
Last active October 10, 2025 17:43
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@ictlyh
ictlyh / libpq-demo.cc
Last active June 10, 2024 02:46
libpq examples.
/*
* Demo of libpq.
* Build: g++ libpq-demo.cc -o libpq-demo -lpq
* Run: ./libpq-demo
*/
#include <arpa/inet.h>
#include <iostream>
#include <libpq-fe.h>
#include <sstream>
@ebidel
ebidel / fancy-tabs-demo.html
Last active February 18, 2025 15:38
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<style>
body {
margin: 0;
}
/* Style the element from the outside */
/*
fancy-tabs {
margin-bottom: 32px;