Skip to content

Instantly share code, notes, and snippets.

View veehz's full-sized avatar
💭
If you wait until the last minute, it only takes a minute to do.

Vee Hua Zhi veehz

💭
If you wait until the last minute, it only takes a minute to do.
  • National University of Singapore
  • Singapore
  • 21:28 (UTC +08:00)
  • LinkedIn in/veehz
View GitHub Profile
@veehz
veehz / segtree.cpp
Created May 23, 2023 04:22
Segment Tree
/* Segment Tree */
template <class S, S (*op)(S, S), S (*e)()>
struct segtree {
int _n;
vector<S> d;
segtree() : segtree(0) {}
explicit segtree(int n) : segtree(vector<S>(n, e())) {}
explicit segtree(vector<S> v) : _n(int(v.size())), d(4 * _n, e()) {
build(v);
}
@veehz
veehz / BackToTop.tsx
Last active March 28, 2025 03:52
back-to-top button (from https://github.com/vfeskov/vanilla-back-to-top, MIT License)
import { useState, useEffect } from "react";
export default function BackToTop() {
const [isHidden, setIsHidden] = useState(true);
useEffect(() => {
const handleScroll = () => {
if (window.pageYOffset > 100) {
setIsHidden(false);
} else {
@veehz
veehz / index.html
Created December 20, 2021 07:03
minesweeper simple bot
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minesweeper</title>
</head>
<body>
<style>
@veehz
veehz / main.js
Last active January 20, 2021 12:50
Vote Counter - Microsoft Forms Ranking Problems
/* Copyright (c) 2021 veehz
*
* Vote counter
* Based on Microsoft Form's Ranking Problems
* The first [count] available votes will be counted for each person.
* People who are selected will not be reselected
* Priority will be based on the list "selections"
*/
const csv = require('csv-parser');
const fs = require('fs');