Skip to content

Instantly share code, notes, and snippets.

View tanvirraj's full-sized avatar
🚢
coding

Tanvir Raj tanvirraj

🚢
coding
View GitHub Profile
@tanvirraj
tanvirraj / mathpix2gpt.py
Created June 13, 2023 07:04 — forked from danielgross/mathpix2gpt.py
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()
package main
import (
"fmt"
"math/rand"
"net/http"
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"

DDD is a way to build computer programs that helps make them easier to understand and use. It's like building with blocks: you start with small, simple blocks and put them together to make bigger, more complex structures.

In DDD, we use something called "domains" to organize our blocks. A domain is like a group of blocks that all have something in common. For example, if we were building a program about pets, we might have a domain for dogs, a domain for cats, and a domain for birds.

Inside each domain, we use something called "entities" to represent the things in our program. An entity is like a specific block that has its own unique properties. For example, in the dog domain, we might have an entity for a specific dog with properties like its name, breed, and age.

We also use "value objects" to represent things that don't have a unique identity, but are still important. For example, in the dog domain, we might have a value object for a dog's collar, which would have properties like its color and size.

F

@tanvirraj
tanvirraj / dependencyInjection.md
Created March 17, 2023 13:26
dependency injection typescript example with classes this file is generated by chatGPT

First, create an interface for the dependency you want to inject, for example:

interface Logger {
  log(message: string): void;
}

Next, create a class that implements the interface:

https://thoughtbot.com/
https://fintory.com/en
https://www.metalab.co/
https://focuslabllc.com/
https://underbelly.is/
https://unfold.co/
https://www.ramotion.com/
https://www.strv.com/
https://tubikstudio.com/
https://cuberto.com/

Go's for-range loop has two form of syntax and two different semantics value semantics and pointer semantics. before sharing details let's first 2 small code snippets one form of for-range loop

package main

import "fmt"

func main() {
@tanvirraj
tanvirraj / Dockerfile
Created January 26, 2023 09:22 — forked from tobi/Dockerfile
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
@tanvirraj
tanvirraj / go-stdlib-interface-selected.md
Created January 25, 2023 16:05 — forked from asukakenji/go-stdlib-interface-selected.md
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

Doing this for every project would get old - turns out you can ignore files in git globally. 1. Create a file at: ~/.gitignore_global 2. Add scratch.md to the first line 3. Run: git config --global core.excludesfile ~/.gitignore_global There ya go, now you can scratch away in your new scratch.md file. Enjoy!

@tanvirraj
tanvirraj / Makefile
Created January 18, 2023 08:33 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.