Skip to content

Instantly share code, notes, and snippets.

View ajitzero's full-sized avatar
✍️
Write, sketch, design.

Ajit Panigrahi ajitzero

✍️
Write, sketch, design.
View GitHub Profile
@ajitzero
ajitzero / .prettierrc.json
Created July 7, 2025 13:33
My Prettier Config
{
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "ignore",
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 80
}
},
graph TD
  feat --> data-access
  feat --> ui
  feat --> type
  feat --> util
  feat --> state
  feat --> guard
  feat --> const
@ajitzero
ajitzero / chatgpt-bookmarklet.js
Last active May 5, 2025 00:00
Bookmarklet for ChatGPT
javascript: (function () {
if (document.getElementById('chatgpt-bookmarklet-ui')) return;
function getCleanSelectedText() {
const selection = window.getSelection();
if (!selection || selection.rangeCount === 0) return '';
const range = selection.getRangeAt(0);
const fragment = range.cloneContents();
const container = document.createElement('div');
@ajitzero
ajitzero / hello.js
Created January 7, 2025 12:39
File-based routing for express
/**
* Inside "src/routes" directory
*/
const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
res.send('Hello World');
});
@ajitzero
ajitzero / easing.js
Created March 10, 2024 22:18 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@ajitzero
ajitzero / minimal.vimrc
Created February 15, 2023 11:22
Basis Vim config with line numbers & highlighting, enabled by toggling F3
highlight CursorLine cterm=NONE ctermbg=darkgray ctermfg=NONE
highlight lineNr cterm=NONE
nnoremap <F3> :set nu! rnu! list!<CR>
nnoremap <silent> <Esc><Esc> :noh<CR> :call clearmatches()<CR>
set backspace=indent,eol,start
set cursorline
set listchars=tab:↳\ ,trail:·,extends:>,precedes:<,nbsp:·
set nonu nornu nolist
set pastetoggle=<F2>
@ajitzero
ajitzero / suggested-ng-component.jsx
Created October 20, 2022 16:59
Suggested syntax for JSX-style Angular components
import { AuthService } from './auth.service';
import { map } from 'rxjs';
export const BaseCard = (title, ...ngContent) => {
const auth = inject(AuthService);
const isPremiumAccount = auth.user$.pipe(
map(user => user.isPremium)
);
return (
// JSX-style template with first-class support for RxJS
@ajitzero
ajitzero / ng.css
Created February 1, 2021 09:18
Overriding Angular Material Tabs
/* ::ng-deep */
::ng-deep.mat-tab-label,
::ng-deep.mat-tab-label-active {
min-width: 0 !important;
padding: 0 10px !important;
margin: 0 20px 0 0 !important;
}
@ajitzero
ajitzero / createSnapshotObjects.util.ts
Last active July 23, 2020 13:13
Convert snapshots received from Firestore to TypeScript-safe objects with ID (using generics).
export function createSnapshotObjects<T>(snapshots): Array<T> {
return snapshots.map(snap => {
return {
id: snap.payload.doc.id,
...snap.payload.doc.data()
};
});
}