Skip to content

Instantly share code, notes, and snippets.

View nmanumr's full-sized avatar

Nauman Umer nmanumr

View GitHub Profile
const fakeObjectSymbol = Symbol('fakeObject');
function getFakeNestedObject(baseName) {
return new Proxy(
{
toString() => baseName,
deps: baseName,
[fakeObjectSymbol]: true,
},
{
import { ChevronUpDownIcon } from '@heroicons/react/24/outline';
import { PropsWithChildren, useContext, useState } from 'react';
import {
Button as ButtonBase,
Collection,
Popover, SelectStateContext,
TreeItemProps,
UNSTABLE_Tree as Tree,
UNSTABLE_TreeItem as TreeItem,
UNSTABLE_TreeItemContent as TreeItemContent,
import Bun from 'bun';
import * as ts from 'typescript';
import { factory } from 'typescript';
const glob = new Bun.Glob('src/**/*.{ts,js,jsx,tsx}');
const tImportFactory = factory.createImportDeclaration(
undefined,
factory.createImportClause(
from django.db import transaction
from ordered_model.serializers import OrderedModelSerializer
from rest_framework import serializers
from rest_framework.serializers import ListSerializer
class ReplaceListSerializer(ListSerializer):
@transaction.atomic()
def update(self, instances, validated_data):
ins_mapping = {ins.id: ins for ins in instances}
@nmanumr
nmanumr / remove-merged.sh
Created January 13, 2022 16:51
remove all the merged branches
git --no-pager branch --merged main | xargs git branch -d
@nmanumr
nmanumr / cfg.h
Last active December 28, 2021 03:14
CFG
#include <iostream>
#include <string>
#include <list>
#include <unordered_map>
#include <set>
using namespace std;
#ifndef CC_CFG_H
#define CC_CFG_H
@nmanumr
nmanumr / eliminate_lr.java
Created November 12, 2021 17:45
CheatSheat
package practice;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
public class eliminate_lr {
@nmanumr
nmanumr / rotate.js
Last active May 20, 2021 20:32
rotate youtube video
let conf = {
flipX: false,
flipY: true,
angle: 180,
};
function rotate(){
let theaterButton = $('.ytp-size-button.ytp-button');
if (theaterButton.title.includes("Theater")) {
setTimeout(rotate, 200);
@nmanumr
nmanumr / MonthSelector.tsx
Created May 15, 2021 19:08
Month Selector in React
import { Component, createRef, RefObject } from "react";
import c from 'classnames';
/*---------------------
* Component Types
*---------------------*/
interface State {
years: number[],
selected: string[],
@nmanumr
nmanumr / assignment01.py
Created October 9, 2020 15:29
NC assignment Bisection method, false position
import math
def r(x):
return str(round(x, 6))
def bisection_print(fn, xl, xu, last_xm=None, last_err=None, iter=1):
out_str = f"\\textbf{{Iteration {iter}}}\n\n"
out_str += "\n\\vspace{20pt}\\textbf{Step 1}\n"
out_str += f"$$ x_{{l}} = {r(xl)}, x_{{u}} = {r(xu)} $$\n"