Skip to content

Instantly share code, notes, and snippets.

View arn4v's full-sized avatar
🚀
Building things in my bedroom

Arnav Gosain arn4v

🚀
Building things in my bedroom
View GitHub Profile
@import 'styles/variables.scss';
@import 'styles/mixins.scss';
* {
box-sizing: border-box;
margin: 0;
padding: 0;
@include smooth-font-rendering;
}
type AnyPromiseFunction = (...params: any[]) => Promise<any>;
export function withPerformanceMonitoring<
T extends AnyPromiseFunction,
ReturnAwaited = Awaited<ReturnType<T>>
>(name: string, func: T): T {
const wrapped = async (...params: Parameters<T>): Promise<ReturnAwaited> => {
const timerName = `Loader performance: ${name}`;
console.time(timerName);
@arn4v
arn4v / rune-square.svg
Created January 3, 2023 05:16
Rune Logo – Square
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arn4v
arn4v / camba-roadmap.md
Last active January 17, 2023 19:30
Roadmap of my browser-based video editor

Roadmap

Currently focussing on table-stakes.

Editor Interface

  • Project settings
    • Frame rate
    • Aspect ratio
  • [🚧] Asset Manager
@arn4v
arn4v / thumbnails.js
Created December 30, 2022 21:21
Get video thumbnails in JS
const getVideoThumbnails = (src: string) => {
let w: number, h: number;
const aspectRatioDivisionMultiple = 2.5;
let screenshotCount = 0;
const screenshots: string[] = [];
const canvas = document.createElement("canvas");
const video = document.createElement("video");
video.autoplay = false;
video.muted = true;
video.src = src;
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Generated schema for Root",
"type": "object",
"properties": {
"port": {
"type": "number"
},
"db": {
"type": "object",
@arn4v
arn4v / linear-estimate.js
Created July 10, 2022 15:15
Get time estimate from a Linear view
const sizeToTimeEstimate = {
xs: 1,
s: 2,
m: 4,
l: 12,
xl: 24,
};
const timeMap = Object.entries(
Array.from(

Option A

import { Tabs } from "ui-library";
import { css } from "ui-library/stitches.config";
import { useRouter } from "next/router";

export function OptionA() {
  const router = useRouter();
@arn4v
arn4v / github-proxy-client.js
Created March 16, 2022 09:39 — forked from DavidWells/github-proxy-client.js
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@arn4v
arn4v / avatar.js
Created June 30, 2021 17:28
Programmatically generate svg avatars
const { renderToStaticMarkup } = require("react-dom/server.node");
const { createElement } = require("react");
const { default: Jazzicon, jsNumberForAddress } = require("react-jazzicon");
const { JSDOM } = require("jsdom");
const el = createElement(Jazzicon, {
diameter: 100,
seed: Math.round(Math.random() * 10000000),
});