Skip to content

Instantly share code, notes, and snippets.

View radiumrasheed's full-sized avatar
🏠
Working from home

Rasheed Rahman radiumrasheed

🏠
Working from home
View GitHub Profile

I build things with code

Keybase proof

I hereby claim:

  • I am radiumrasheed on github.
  • I am radiumrasheed (https://keybase.io/radiumrasheed) on keybase.
  • I have a public key ASComMcs9ZUOEWPOBdqcsg_lyLQvtoL5LhufIinipke1hAo

To claim this, I am signing this object:

@radiumrasheed
radiumrasheed / app-injector.ts
Created March 13, 2021 13:44
Simplify components with ts inheritance
import { Injector } from '@angular/core';
export class AppInjector {
private static injector: Injector;
static setInjector(injector: Injector) {
AppInjector.injector = injector;
}
@radiumrasheed
radiumrasheed / index.js
Created March 15, 2021 11:37
Comparing Left and Right Branch of a Complete Binary Tree
const solution = (arr) => {
if (!arr) return "";
if (arr.length === 0) return "";
const sum = (arr, idx) => {
if (idx - 1 < arr.length) {
if (arr[idx - 1] === -1) return 0;
return arr[idx - 1] + sum(arr, idx * 2) + sum(arr, idx * 2 + 1);
}
return 0;
};
@radiumrasheed
radiumrasheed / ColumnFilter.js
Created January 9, 2022 18:57 — forked from srsandy/ColumnFilter.js
React Table Server side Pagination and Filtering
import "regenerator-runtime/runtime";
import { useState } from "react";
import { useAsyncDebounce } from "react-table";
const ColumnFilter = ({ column }) => {
const { filterValue, setFilter } = column;
const [value, setValue] = useState(filterValue);
const onChange = useAsyncDebounce((value) => {
setFilter(value || undefined);
}, 300);
@radiumrasheed
radiumrasheed / Array.batch.js
Created February 3, 2022 18:33 — forked from seanmonstar/Array.batch.js
Similar to Array.each, but loops in batches, use setTimeout to allow the Browser thread to do other things, like respond to UI events and changes. Useful for really big arrays, or really intensive functions.
Array.implement('batch', function(callback, loopsPerBatch, delay, bind) {
if(!loopsPerBatch) loopsPerBatch = 10;
if(!delay) delay = 50;
if(callback) {
var loops = 0,
index = 0,
that = this;
function doLoops() {
loops = 0;
for (var length = that.length; (index < length) && loops < loopsPerBatch; index++) {