from datetime import datetime
from sqlmodel import Field, SQLModel
from sqlalchemy import Column, text, DateTime
class BaseModel(SQLModel):
id: int = Field(default=None, primary_key=True)
This file contains hidden or 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
| body { | |
| margin: 0 auto; | |
| max-width: 50em; | |
| font-family: "Roboto", "Helvetica", "Arial", sans-serif; | |
| line-height: 1.5; | |
| padding: 4em 1em; | |
| color: #566b78; | |
| } | |
| h1, |
This file contains hidden or 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
| alias studio='function _open_android_studio() { open -a "Android Studio" "${1:-.}"; }; _open_android_studio' | |
| # Usage | |
| # studio . | |
| # studio project/ |
| Type | Description |
|---|---|
| feat | A new feature |
| fix | A bug fix |
| docs | Changes in documentation |
| style | Everything related to styling |
| refactor | Code changes that neither fix a bug nor add a feature |
| test | Everything related to testing |
| chore | Updating build tasks, package manager configs, etc |
| perf | Performance improvements |
This file contains hidden or 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
| ffmpeg -fflags +genpts -i input.webm output.mp4 |
This file contains hidden or 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
| export function timeAgo(value: string) { | |
| const seconds = Math.floor((new Date().getTime() - new Date(value).getTime()) / 1000) | |
| let interval = seconds / 31536000 | |
| const rtf = new Intl.RelativeTimeFormat("en", { numeric: 'auto' }) | |
| if (interval > 1) { return rtf.format(-Math.floor(interval), 'year') } | |
| interval = seconds / 2592000 | |
| if (interval > 1) { return rtf.format(-Math.floor(interval), 'month') } | |
| interval = seconds / 86400 | |
| if (interval > 1) { return rtf.format(-Math.floor(interval), 'day') } | |
| interval = seconds / 3600 |
This file contains hidden or 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
| # Move backward one commit back | |
| alias gitbwd='git log --all --decorate --oneline | grep -A 1 $(git rev-parse --short HEAD) | awk "{print \$1}" | tail -1 | xargs -I {} git checkout {}' | |
| # Move forward one commit up | |
| alias gitfwd='git log --all --decorate --oneline | grep -B 1 $(git rev-parse --short HEAD) | awk "{print \$1}" | head -1 | xargs -I {} git checkout {}' | |
| # See the files names that got changed between the commit | |
| alias cdiff='git diff --name-only HEAD~1 HEAD' |
This file contains hidden or 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
| const CURRENCY_FORMATTER = new Intl.NumberFormat(undefined, { | |
| currency: "INR", | |
| style: "currency", | |
| }); | |
| export function formatCurrency(number: number) { | |
| return CURRENCY_FORMATTER.format(number); | |
| } |