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 / compress_video
Created August 23, 2024 06:55 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@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()
@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.

@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.
@tanvirraj
tanvirraj / cache.ts
Created September 22, 2022 06:29 — forked from steveruizok/cache.ts
weak map gist
export class Cache<T extends object, K> {
items = new WeakMap<T, K>()
get<P extends T>(item: P, cb: (item: P) => K) {
if (!this.items.has(item)) {
this.items.set(item, cb(item))
}
return this.items.get(item)!
}
@tanvirraj
tanvirraj / useCalendar.js
Created September 4, 2022 11:25 — forked from tannerlinsley/useCalendar.js
Calendar Hook
import React from 'react'
import addDays from 'date-fns/add_days'
import isBefore from 'date-fns/is_before'
import isToday from 'date-fns/is_today'
import startOfDay from 'date-fns/start_of_day'
import differenceInCalendarMonths from 'date-fns/difference_in_calendar_months'
export default function useCalendar({
date = new Date(),
offset: userOffset = 0,
@tanvirraj
tanvirraj / The Rules.md
Created April 14, 2022 10:47 — forked from sebmarkbage/The Rules.md
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

kaths-bookshelf

There's a lot of recommended reading for product managers out there. Some of it is incredibly useful, and some of it is a waste of time. Business books don't really get me excited, but there are a few books, articles, newsletters, and podcasts authored by folks I look up to in the industry that I find myself coming back to often. When you're reading about product management, it's important to take everything with a grain of salt. The industry changes rapidly, and so does the discipline. If you learn something you want to try out from one of these books, go for it! But be careful not to whiplash yourself or your team.

I find new books and articles all the time, so I'm going to start dropping them here. Hope they help and inspire some other Product folks!

Books

Delivering Happiness by Tony Hsieh

Learning about how others have launched successful products and companies is definite