It makes text are auto grow
<textarea
onInput={(e) => {
e.target.style.height = "5px";
e.target.style.height = e.target.scrollHeight + "px";
}}
import concurrent.futures | |
from django.http import JsonResponse | |
def func1(param1, param2): | |
# Your function implementation | |
return f"result from func1 with {param1} and {param2}" | |
def func2(param1): | |
# Your function implementation | |
return f"result from func2 with {param1}" |
""" | |
Author: Jatin Sharma | |
Working: | |
* It take the date from string input and converts that to the the short version | |
---- INPUT----- | |
- March 2022 | |
- Mar'22 |
import useSWR from "swr"; | |
// fetcher to fetch the data | |
// const fetcher = (...args) => fetch(...args).then((res) => res.json()); | |
import fetcher from "@lib/fetcher"; | |
export default function useFetchWithSWR(url: string) { | |
const { data, error } = useSWR(url, fetcher); | |
return { |
function getOS() { | |
var userAgent = window.navigator.userAgent, | |
platform = window.navigator.platform, | |
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], | |
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], | |
iosPlatforms = ['iPhone', 'iPad', 'iPod'], | |
os = null; | |
if (macosPlatforms.indexOf(platform) !== -1) { | |
os = 'Mac OS'; |
// Returns like: Dec 13, 2022 | |
export function getFormattedDate(date) { | |
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec']; | |
const newDate = new Date(date) | |
return `${months[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`; | |
} |
It makes text are auto grow
<textarea
onInput={(e) => {
e.target.style.height = "5px";
e.target.style.height = e.target.scrollHeight + "px";
}}
#include <bits/stdc++.h> | |
#define el "\n" | |
#define rep(i, a, b) for (int i = a; i < b; i++) | |
typedef long long ll; | |
using namespace std; | |
//---------------------- Solution Starts Here ---------------------- |
#include <bits/stdc++.h> | |
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) | |
#define pb(a) push_back(a) | |
#define fr(a,b) for(int i = a;i < b; i++) | |
typedef long long ll; | |
using namespace std; | |
void init_code(){ |