Skip to content

Instantly share code, notes, and snippets.

View tjsudarsan's full-sized avatar

Sudarsan T J tjsudarsan

View GitHub Profile
@tjsudarsan
tjsudarsan / react-markdown-with-math.js
Created April 12, 2023 08:38
Rendering math with react-markdown [UPDATED]
import ReactMarkdown from "react-markdown";
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
import "katex/dist/katex.min.css";
const App = (props) => {
const md = `The equation for softmax function is:\n\n$$\\sigma(z)_j = \\frac{e^{z_j}}{\\sum\\limits_{k=1}^{K}e^{z_k}}$$\n\nwhere $z$ is the input vector of length $K$ and $\\sigma(z)$ is the output vector of length $K$, with each element representing the probability of the input belonging to that class.`;
return (
<ReactMarkdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
@tjsudarsan
tjsudarsan / Change CRLF to LF to all Files.md
Last active May 16, 2024 07:40
Change End of Line Sequence from CRLF to LF to all files in the project for supporting ESLint

Converting the End of Line Sequence from CRLF to LF in any of your project files

Execute the following commands in your root of your project folder

NOTE: Do not do the following steps without commiting your data. As it clears all the git cache and it will clear all your changes in your project.

  1. First disable the autoCRLF in the git config by running the following command in your terminal git config core.autocrlf false

  2. Then remove the cached files in the git. Run the following command:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.example.com/$1 [R,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]