Skip to content

Instantly share code, notes, and snippets.

View lukaabra's full-sized avatar

Luka Abramović lukaabra

View GitHub Profile
@lukaabra
lukaabra / FindStringInFile.cs
Last active December 2, 2020 10:23
Finds a specified keyword inside of a text file
/// <summary>
/// Returns true or false depending on if a text file contains the specified word in the content
/// Example:
/// FindWordInFile("error", "C:/user/Desktop/test.txt");
/// </summary>
/// <param name="word">Word to find in text file</param>
/// <param name="filePath">Absolute path to the text file</param>
/// <returns>True if the word is inside of the file, false if not.</returns>
static public bool FindWordInFile(string word, string filePath)
{
@lukaabra
lukaabra / compare.js
Created August 3, 2020 11:23
Compare the performance of checking whether an element is in an array before pushing it, and adding elements to a set in Node.
const {
performance
} = require('perf_hooks');
let arrayTime = [],
arrayLen = [],
setTime = [],
setLen = [];
let times = 1000