Skip to content

Instantly share code, notes, and snippets.

View afkcodes's full-sized avatar
💭
afk

Ashish Kumar afkcodes

💭
afk
View GitHub Profile
@afkcodes
afkcodes / DelayedMaskedInput.tsx
Created April 15, 2025 09:21
A Masked Input Component with Delay
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
interface CharacterByCharacterMaskInputProps
extends Omit<
React.HTMLAttributes<HTMLInputElement>,
'onChange' | 'value' | 'defaultValue' | 'type'
> {
maskDelay?: number;
maskChar?: string;
className?: string;
@afkcodes
afkcodes / theme.json
Created July 3, 2024 07:40
VS Code custom theme vars
"workbench.colorCustomizations": {
"editor.background": "#131313",
"editor.foreground": "#EEFFFF",
"sideBar.background": "#131313",
"sideBar.foreground": "#B0BEC5",
"sideBar.border": "#2A2A2A",
"activityBar.background": "#131313",
"activityBar.foreground": "#EEFFFF",
"activityBar.border": "#2A2A2A",
"statusBar.background": "#131313",
@afkcodes
afkcodes / bg-grad.html
Created June 30, 2024 09:49
background card gradient
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Gradient Background Effect</title>
<style>
body {
margin: 0;
height: 100vh;
@afkcodes
afkcodes / zomato.js
Last active April 10, 2024 10:36
Zomato Lifetime Spend Calculator
let currentPage = 0;
let lastPage = 100;
let total = 0;
const fetchSpends = async (page) => {
console.log(`fetching for ${page}, ${lastPage}`);
const res = await fetch(`https://www.zomato.com/webroutes/user/orders?page=${page}`);
const data = await res.json();
lastPage = data.sections.SECTION_USER_ORDER_HISTORY.totalPages;
return data.entities.ORDER;
};
@afkcodes
afkcodes / BottomTab.js
Created July 15, 2023 10:27
Navigation Test
import { StateNavigator } from 'navigation';
import { NavigationContext, NavigationHandler } from 'navigation-react';
import { NavigationBar, NavigationStack, Scene, TabBar, TabBarItem } from 'navigation-react-native';
import React, { useContext, useMemo } from 'react';
import { Platform } from 'react-native';
import Home from '~screens/Home';
import Player from '~screens/Player';
import Search from '~screens/Search';
import { theme } from '~styles';
import { fonts } from '~styles/theme';
@afkcodes
afkcodes / Player.js
Last active July 15, 2023 05:06
Player Scene Navigation
const stateNavigator = new StateNavigator([
{ key: 'tabs' },
{ key: 'home', trackCrumbTrail: true },
{ key: 'search', trackCrumbTrail: true },
{ key: 'player', trackCrumbTrail: true }
]);
const App = () => {
return (
<>
@afkcodes
afkcodes / nav-example.ts
Created July 14, 2023 19:40
Navigation
// App.tsx
import React from 'react';
import { StateNavigator } from 'navigation';
import { NavigationHandler } from 'navigation-react';
import { NavigationStack, Scene } from 'navigation-react-native';
import BottomTabs from '~navigation/BottomTabs';
import Search from '~screens/Search';
const stateNavigator = new StateNavigator([{ key: 'tabs' }, { key: 'search' }]);
@afkcodes
afkcodes / letsencrypt_create.sh
Created July 2, 2023 11:06 — forked from ervilis/letsencrypt_create.sh
Script to generate LetsEncrypt certificate
#!/bin/sh
#
# Wrapper script for the letsencrypt client to generate a server certificate in
# manual mode. It uses openssl to generate the key and should not modify the
# server configuration. It can be called off-side, i.e. not on the destination
# server.
#
# usage: letsencrypt_create.sh DOMAIN [DOMAIN...]
set -e
@afkcodes
afkcodes / squircle.dart
Created May 8, 2023 05:58 — forked from slightfoot/squircle.dart
Flutter Squircle Shape
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Squircle',
home: new Scaffold(
@afkcodes
afkcodes / dataMiner.js
Created January 5, 2022 07:41 — forked from Harshmakadia/dataMiner.js
twitter-analytics-data-scraper
// 1. Go to https://analytics.twitter.com/
// 2. Keep scrolling till the end until all the stats data is loaded
// 3. Right click on the page click on last option "Inspect" a window should open select console from that
// 4. copy this entire function
function getVal (val) {
val=val.replace(/\,/g,'');