Skip to content

Instantly share code, notes, and snippets.

View iRajatDas's full-sized avatar
🎯
Focusing

Rajat Das iRajatDas

🎯
Focusing
View GitHub Profile
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
function slugify(input) {
if (!input)
return '';
// make lower case and trim
var slug = input.toLowerCase().trim();
[
{
"mimeType": "video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"",
"qualityLabel": "360p",
"bitrate": 447587,
"audioBitrate": 96,
"itag": 18,
"url": "https://rr4---sn-qxaelnes.googlevideo.com/videoplayback?expire=1712789895&ei=J8UWZrDFM4Gr3LUPzvu7IA&ip=122.177.98.86&id=o-AJVEMCQmh6rLbBsZYohC9yXbRirzMY1teTnMY6f54gId&itag=18&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=8k&mm=31%2C29&mn=sn-qxaelnes%2Csn-ci5gup-qxae7&ms=au%2Crdu&mv=m&mvi=4&pl=21&initcwndbps=1243750&bui=AaUN6a3EHkQIsxPqJv7c781ZrmkPrcaGD5Soj_oWW3S0rbZq3-9BcBd0xm94Vq6_Kis2472oMR72yTf0&spc=UWF9fxROmUgEM1a8p7bD19Ek3QWWf3GVN6DCoIlGvBXlpZulS8ieByXfrA&vprv=1&svpuc=1&mime=video%2Fmp4&ns=g-nM1eGw8ymvGwMawR4r-ioQ&gir=yes&clen=83387712&ratebypass=yes&dur=1490.512&lmt=1712764016533205&mt=1712767977&fvip=8&c=WEB&sefc=1&txp=3309224&n=NYOYmPVUb5WzQA&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AJfQdSswRQIgYUso35uIuI5Lg3KGrL9YgwlXV_
import "@/styles/react-intl.css"
import React, { useState, ReactElement } from "react";
import { createRoot } from "react-dom/client";
import IntlTelInput from "../src/intl-tel-input/react";
import utilsScriptURL from "intl-tel-input/build/js/utils";
const errorMap = [
"Invalid number",
"Invalid country code",
"Too short",
:root {
--iti-hover-color: rgba(0, 0, 0, 0.05);
--iti-text-gray: #999;
--iti-border-gray: #ccc;
--iti-spacer-horizontal: 8px;
--iti-flag-height: 15px;
--iti-flag-width: 20px;
--iti-border-width: 1px;
--iti-arrow-height: 4px;
--iti-arrow-width: 6px;
@iRajatDas
iRajatDas / react-intl.tsx
Created April 8, 2024 07:40
react telephone input
import "@/src/styles/intl-react.css";
import React, { useRef, useEffect } from "react";
import intlTelInput, { Iti, SomeOptions } from "intl-tel-input";
const IntlTelInput = ({
initialValue = "",
onChangeNumber = (): void => {},
onChangeCountry = (): void => {},
onChangeValidity = (): void => {},
onChangeErrorCode = (): void => {},
@iRajatDas
iRajatDas / googleMaps.js
Created January 5, 2024 05:06 — forked from adrianhorning08/googleMaps.js
Scrape Google Maps
import * as cheerio from "cheerio";
import puppeteerExtra from "puppeteer-extra";
import stealthPlugin from "puppeteer-extra-plugin-stealth";
import chromium from "@sparticuz/chromium";
async function searchGoogleMaps() {
try {
const start = Date.now();
puppeteerExtra.use(stealthPlugin());
@iRajatDas
iRajatDas / SplitText3.min.js
Created December 3, 2023 14:21 — forked from nicubarbaros/SplitText3.min.js
SplitText from GSAP - not commercial use
/* eslint-disable */
!(function(D, u) {
"object" == typeof exports && "undefined" != typeof module
? u(exports)
: "function" == typeof define && define.amd
? define(["exports"], u)
: u(((D = D || self).window = D.window || {}));
})(this, function(e) {
"use strict";
var v = "";
@iRajatDas
iRajatDas / dosu.php
Created December 31, 2022 06:16 — forked from karthikax/dosu.php
PHP Download file to server from URL
<html>
<p style="width: 70%;margin: auto;margin-top: 5%;font-size:larger;text-align:center">
Download a file from any URL</p>
<form method="post" style="width: 70%;margin: auto;margin-top: 10%;">
<input name="url" size="50" placeholder="Source URL" style="width: 100%;height: 10%;font-size: 1.5em;padding:10px" required>
<input name="submit" type="submit" value="Download" style="width: 30%;height: 10%;margin: 5% auto; display: block;">
<p style="width: 70%;margin: auto;margin-top: 10%;font-size:larger;text-align:center">
To <?php echo getcwd(); ?></p>
<p style="width: 70%;margin: auto;font-size: smaller;text-align: center;position: fixed;bottom: 0;background: #fff;">
Powered by: <a href="https://karthikbhat.net/portfolio" target="_blank" style="color:#f60;text-decoration:none;">Karthik</a></p>
@iRajatDas
iRajatDas / primary_category.php
Created December 7, 2022 08:41 — forked from jawinn/primary_category.php
Display Primary Category (Yoast's WordPress SEO)
<?php
/**
* Get the Yoast primary category from its post meta value, and displays it, with HTML markup.
* If there is no primary category set, it displays the first assigned category.
*
* @param boolean $useCatLink Whether to link the category, if it exists
* @return void
*/
function yourtheme_display_yoast_primary_category( $useCatLink = true ) {
@iRajatDas
iRajatDas / wp-config.php
Created December 7, 2022 08:30 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url