Skip to content

Instantly share code, notes, and snippets.

View Blezzoh's full-sized avatar

Blaise Iradukunda Blezzoh

View GitHub Profile
@Blezzoh
Blezzoh / hw1_blaiseiradukunda-linear.ipynb
Created March 17, 2022 02:42
HW1_BlaiseIradukunda.linear.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Blezzoh
Blezzoh / hw1_blaiseiradukunda-convo.ipynb
Created March 17, 2022 02:40
hw1_BlaiseIradukunda.convo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lab07.md</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
public class MyClass {
/*
Consider an array A with n of positive integers.
An integer idx is called a POE (point of equilibrium) of A,
if A[0] + A[1] + … + A[idx – 1] is equal to A[idx + 1] + A[idx + 2] + … + A[n – 1].
Write a function to return POE of an array, if it exists and -1 otherwise.
The signature of the function is:
int f(int[] a)
const isObject = function (o) {
return o === Object(o) && !isArray(o) && typeof o !== 'function';
};
const isArray = function (a) {
return Array.isArray(a);
};
const toCamel = (s) => {
return s.replace(/([-_][a-z])/ig, ($1) => {
return $1.toUpperCase()
.replace('-', '')
@Blezzoh
Blezzoh / infiniteScrollR7.js
Last active February 26, 2020 07:01
infinite scroll ability
import React from "react";
import { useTable, useSortBy, useFilters, useGlobalFilter, useFlexLayout, useResizeColumns } from "react-table";
import CustomInput from "./CustomInput";
import { InfiniteLoader, List , AutoSizer } from 'react-virtualized';
window.Date.prototype.isValid = function () {
// An invalid date object returns NaN for getTime() and NaN is the only
// object not strictly equal to itself.
// eslint-disable-next-line
return this.getTime() === this.getTime();
@Blezzoh
Blezzoh / react-table7-subcomponent.js
Last active December 22, 2022 16:18
subcomponent for react table 7
import React from "react";
import { useTable, useSortBy, useFilters, useGlobalFilter, useFlexLayout, useResizeColumns, useExpanded } from "react-table";
import CustomInput from "./CustomInput";
const rt7Expander = {
// Make an expander cell
Header: () => null, // No header
id: 'expander', // It needs an ID
width: 25,
Cell: ({ row }) => (
@Blezzoh
Blezzoh / react-table7-resizer.js
Last active February 25, 2020 21:52
react-table 7 resizer
import React from "react";
import { useTable, useSortBy, useFilters, useGlobalFilter, useFlexLayout, useResizeColumns } from "react-table";
import CustomInput from "./CustomInput";
window.Date.prototype.isValid = function () {
// An invalid date object returns NaN for getTime() and NaN is the only
// object not strictly equal to itself.
// eslint-disable-next-line
return this.getTime() === this.getTime();
};
@Blezzoh
Blezzoh / globalFilterRT7.js
Created February 25, 2020 02:28
custom component for the global filter in react-table 7
// value and onChange function
const GlobalFilter = ({ globalFilter, setGlobalFilter }) => {
return (
<input
value={globalFilter || ""}
onChange={e => {
setGlobalFilter(e.target.value || undefined); // Set undefined to remove the filter entirely
}}
placeholder={`Search All ...`}
/>
import React from "react";
import { Table } from "react-bootstrap";
import { useTable, useSortBy, useFilters } from "react-table";
import CustomInput from "./CustomInput";
window.Date.prototype.isValid = function() {
// An invalid date object returns NaN for getTime() and NaN is the only
// object not strictly equal to itself.
// eslint-disable-next-line
return this.getTime() === this.getTime();