This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEditor, EditorContent } from "@tiptap/react"; | |
import StarterKit from "@tiptap/starter-kit"; | |
import Mention from "@tiptap/extension-mention"; | |
import "./mention/styles.css"; | |
import suggestion from "./mention/suggestion"; | |
const getSuggestions = ({ id, query }: { id: string; query: string }) => { | |
// do something with id and query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wt and wsl | |
export win10="/mnt/c/Users/Bharath" | |
function coolpanes() { | |
cmd.exe /c "wt.exe" -p $1 -d $2 \; split-pane -p $1 -d $2 \; split-pane -H -p $1 -d $2 & | |
} | |
alias lbla="coolpanes \"Ubuntu - Projects\" //wsl$/Ubuntu/home/bharath/projects/bla" | |
function cwdpanes() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inefficient | |
[func(item) for item in values if func(item) < 13.5] | |
# Efficient | |
[result for item in values if (result := func(item)) < 13.5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conditional statements | |
# Normal | |
var = some_function() | |
if var: | |
do_something() | |
# Using := | |
if var := some_function(): | |
do_something() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Current code | |
while True: | |
line = fp.readline() | |
if not line: | |
break | |
m = define_rx.match(line) | |
if m: | |
n, v = m.group(1, 2) | |
try: | |
v = int(v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before the walrus operator | |
line = f.readline() | |
while line: | |
process(line) | |
line = f.readline() | |
# After | |
while line := f.readline(): | |
process(line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Bharath Sriraam R R | |
def bla(m,s): | |
n=(s+7)//9 | |
sl=9*n -7 | |
c=10**(n-1) | |
b=10**(m-1) | |
p=int((2+s-sl)*c -1) | |
return p+b | |