Skip to content

Instantly share code, notes, and snippets.

@tomiolah
tomiolah / calc.py
Created February 17, 2020 17:34
University Media Calculator
#!python3
class Subject:
def __init__(self, grade: int, credit: int):
self.g = grade
self.c = credit
####################################
# CHANGE HERE #
####################################
@tomiolah
tomiolah / main.cpp
Created October 19, 2020 21:20
Generic, dynamically allocated C++ array class with functional map, filter and reduce methods
#include <iostream>
#include <math.h>
using namespace std;
// Array Implementation
@tomiolah
tomiolah / main.js
Last active January 19, 2024 14:43
RMBGYSz aranymondasok osszesitve a szentiras.hu-rol vett igeversekkel
const moment = require('moment');
const axios = require('axios').default;
const months = "januar februar marcius aprilis majus junius julius augusztus szeptember oktober november december".split(
" "
);
const getBibleVerse = async (ref) => {
const { data: html } = await axios.get(
`https://szentiras.hu/RUF/${ref.replace(" ", "")}`,
@tomiolah
tomiolah / react-starter-notes.md
Last active February 1, 2024 13:57
React Starter Notes

Main Concepts

  • JSX produces React elements
  • "React embraces the fact that rendering logic is inherently coupled with other UI logic: how events are handled, how the state changes over time, and how the data is prepared for display."

  • Separation of concerns by components that contain Markup and Logic (suck it, Angular!)
  • React doesn't require JSX
  • JSX is an expression (can be used in IF / FOR)
  • Quotes XOR Curly Braces
  • JSX prevents injection attacks e.g. XSS
  • JSX is compiled by Babel to vanilla JS (React.createElement() calls) => React Element
@tomiolah
tomiolah / VolumeControl.ahk
Created May 3, 2021 16:01
AutoHotKey Script to Control Volume with NumpadKeys (+ / - / .) - for keyboards with clunky / no media volume controls
#SingleInstance force
#NumpadAdd:: Send {Volume_Up}
#NumpadSub:: Send {Volume_Down}
#NumpadDot:: Send {Volume_Mute}
@tomiolah
tomiolah / recoilPersistLocalForage.ts
Created March 1, 2022 13:04
Recoil effect, which persists + reads Recoil atom state to / from localForage (IndexedDB)
import localforage from 'localforage';
import { AtomEffect, DefaultValue } from 'recoil';
/**
* Recoil module to persist state to storage
*/
export const recoilPersistLocalForage = ({ key = 'recoil-persist' }: { key?: string }): { persistAtom: AtomEffect<any> } => {
if (typeof window === 'undefined') {
return {
persistAtom: () => {},
@tomiolah
tomiolah / html2pdf.js
Created May 2, 2022 07:16 — forked from antfu/html2pdf.js
HTML to PDF
import puppeteer from 'puppeteer'
import fs from 'fs'
async function buildPDF(htmlString) {
const browser = await puppeteer.launch({ headless: true })
const page = await browser.newPage();
await page.setContent(htmlString, { waitUntil: 'networkidle0' })
const pdf = await page.pdf({
format: 'A4',
displayHeaderFooter: false,
@tomiolah
tomiolah / TS Utils
Last active January 19, 2024 17:00
TS Utilities
@tomiolah
tomiolah / userscript.js
Last active June 5, 2023 08:26
Tampermonkey script that injects a "Copy to ProPresenter" button to Songpraise pages + a backup button
// ==UserScript==
// @name Songpraise 'Copy for ProPresenter' button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description A userscript that adds a 'Copy for ProPresenter' button to Songpraise - it adds 2 buttons: one for copying and another for re-adding the copy button if something goes wrong (fixed position on the page)
// @author Tomi Olah
// @license GNU GPLv3
// @match https://www.songpraise.com/
// @icon https://www.songpraise.com/favicon.ico
// @grant GM_addElement
/** Interface that encompasses all props returned by the creator function */
interface ICBProps {
/** ID of the Timer that was created */
id: number;
/** Function that stops the created timer */
stop: () => void;
}
/** Type of a callback function that is aware of its own ID and can stop itself from within */
type CBFn = (stop: ICBProps["stop"], id: ICBProps["id"]) => void;