Skip to content

Instantly share code, notes, and snippets.

View MustSeeMelons's full-sized avatar

MustSeeMelons

View GitHub Profile
@MustSeeMelons
MustSeeMelons / search.ts
Created December 22, 2020 15:04
Show The Logs Harold - Element content search
useEffect(() => {
const children = jsonRef.current.getElementsByTagName("*");
const childArray = [].slice.call(children) as HTMLElement[];
const filterElements: HTMLElement[] = [];
childArray.forEach((el) => {
if (
el.textContent &&
el.textContent.includes(props.filterValue) &&
el.children.length === 0 &&
props.currentFilteredJson
@MustSeeMelons
MustSeeMelons / options.ts
Created December 22, 2020 15:03
Show The Logs Harold - Listen for element change
useEffect(() => {
if (activeFilterElement !== 0) {
setActiveFilterElement(0);
const hasElements =
refStore[REF_KEY.FILTER_ELEMENTS] &&
(refStore[REF_KEY.FILTER_ELEMENTS] as HTMLElement[]).length > 0;
hasElements &&
(refStore[REF_KEY.FILTER_ELEMENTS][0] as HTMLElement).scrollIntoView({
behavior: "smooth",
@MustSeeMelons
MustSeeMelons / file-service.ts
Created December 22, 2020 12:58
Show The Logs Harold - file service
import readLine from "readline";
import fs from "fs";
import { BrowserWindow } from "electron";
import { ILogFile, PROCESS_EVENTS } from "../../definitions";
let totalLineCount = 0;
let currentLine = 0;
let file: string;
let logs: string[] = [];
@MustSeeMelons
MustSeeMelons / renderer.tsx
Created December 22, 2020 11:41
Show The Logs Harold - renderer.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import { Root } from "./components/root";
ReactDOM.render(<Root />, document.getElementById("app"));
@MustSeeMelons
MustSeeMelons / gist:c6c6eac4c555dd86e04aa59f7f730279
Last active December 22, 2020 11:39
Show The Logs Harold - main.ts
import { app, BrowserWindow } from "electron";
import * as url from "url";
import * as path from "path";
import { setupMainEventListeners } from "./main-events";
let mainWindow: Electron.BrowserWindow;
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({