Skip to content

Instantly share code, notes, and snippets.

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

texoport saiashirwad

🏠
Working from home
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active April 19, 2025 12:06
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@veekaybee
veekaybee / normcore-llm.md
Last active May 15, 2025 00:06
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@rphlmr
rphlmr / clear-db.ts
Last active May 13, 2025 10:53
Drizzle snippets
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406
import { sql } from "drizzle-orm";
const clearDb = async (): Promise<void> => {
const query = sql<string>`SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
`;
@lawrencecchen
lawrencecchen / kyselyAdapter.ts
Last active February 10, 2023 10:04
next-auth kysely adapter
import type { Kysely, RawBuilder } from "kysely";
import type { Account } from "next-auth";
import type {
Adapter,
AdapterSession,
VerificationToken,
AdapterUser,
} from "next-auth/adapters";
import type { DB } from "shared";
@MasoodGit
MasoodGit / keybindings.json
Last active January 18, 2025 14:55
vscode vim keybindings and settings.json
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusRightGroup",

JavaScript Interview Questions

Q1: Explain equality in JavaScript ☆

Answer: JavaScript has both strict and type–converting comparisons:

  • Strict comparison (e.g., ===) checks for value equality without allowing coercion
  • Abstract comparison (e.g. ==) checks for value equality with coercion allowed

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@slikts
slikts / immer-underrated.md
Last active October 30, 2023 07:43
Appreciating the elegant simplicity of Immer

nelabs.dev

Appreciating the elegant simplicity of Immer

There is an ongoing shift in programming towards a more constrained mindset, recognizing shared mutable state and side effects as significant sources of accidental complexity and concepts like immutability and reactive, unidirectional pipelines as ways to overcome it. Simplicity is less optional than before, based on an understanding about the limited capacity of human working memory and based on programming language theory and practice. The functional programming ideas seeping into the mainstream leave less people to say that they wouldn't need them because of maybe never having used them.

The basic idea of controlling complexity through constraints is not novel at all, though, and it raises a valid question about why this shift has taken so long to develop, despite the overall trends towards automation and productivity. For example, the distincti

@suriyadeepan
suriyadeepan / grid.js
Created January 4, 2017 03:04
"All work and no play makes Jack a dull boy" - Cellular Automata in p5.js
function Grid(cells, generation, cell_scale){
this.text = " all work and no play makes jack a dull boy ";
// cells
this.cells = cells;
this.generation = generation;
// scale
this.cell_scale = cell_scale;
// create next generation
this.next_gen = function(ruleset){
@gtors
gtors / underscore_to_camel_case
Created August 20, 2015 11:38
Postgresql function which converts json underscored keys to camel case keys.
CREATE FUNCTION key_underscore_to_camel_case(s text)
RETURNS json
IMMUTABLE
LANGUAGE sql
AS $$
SELECT to_json(substring(s, 1, 1) || substring(replace(initcap(replace(s, '_', ' ')), ' ', ''), 2));
$$;
-- TODO: add recursive processing
CREATE FUNCTION json_underscore_to_camel_case(data json)