Proof (integral of holomorphic function along closed triangle vanishes)
Holomorphic on $U$
Let $L = \mathrm{length}(\partial T)$ and $I = \left|\int_{\partial T} f\right|$. The idea is that the triangle can be shrunk to being close to a point.
Bisect the edge of $T$ to obtain four triangles $Δ_1, Δ_2, Δ_3, Δ_4$, each with parameter $L/2$. By orienting them positively, $\partial T = \partial Δ_1 + \partial Δ_2 + \partial Δ_3 + \partial Δ_4$. Then $$ \begin{align*} I = \left|\int_{\partial T} f\right| = \left|\sum_{i=1}^{4} \int_{\partial Δ_i} f\right| \leq \sum_{i=1}^{4} \left|\int_{\partial Δ_i} f\right| \end{align*} $$ so at least one of them satisfies $$ \begin{align*} \left|\int_{\partial Δ_i} f\right| \geq \frac{I}{4}. \end{align*} $$ Call this $T_1$.
Repeat to obtain a sequence of nested triangles $$ \begin{align*} T \supseteq T_1 \supseteq T_2 \supseteq T_3 \supseteq \ldots \end{align*} $$ with $\mathrm{length}(\partial T_n) = L/2^n$ and $|\int_{\partial T_n} f| \geq I/4^n$.
As a decreasing sequence of closed sets in a compact space, $\bigcap_{n=1}^{\infty} T_n$ will be a single point $w\in U$.
Let $$ \begin{align*} g(z) := \frac{f(z) - f(w)}{z-w} - f'(w), \end{align*} $$ which is continuous on $U$. Now we can bound $$ \begin{align*} I \leq{}& 4^n \left|\int_{\partial T_n} f(z) \d z\right| \\ ={}& 4^n \left|\int_{\partial T_n} f(z) - f(w) - (z-w)f'(w) \d z\right| \tag{*} \\ ={}& 4^n \left|\int_{\partial T_n} (z-w)g(z) \d z\right| \\ \leq{} & 4^n \cdot \mathrm{length}(\partial T_n) \cdot \sup_{z\in \partial T_n} \bigl|(z-w) g(z)\bigr| \\ \leq{}& 4^n \cdot (\mathrm{length}(\partial T_n))^2 \cdot \sup_{\partial T_n} |g| \\ ={} & L^2 \cdot \sup_{\partial T_n} |g| \to 0 \end{align*} $$ as $n\to \infty$, where $(*)$ applies the fundamental theorem of calculus to the polynomial $(z-w)f'(w) + f(w)$ along a closed curve.
Holomorphic on $U$ except finitely many points
Suppose $f$ is continuous on $U$ and holomorphic on $U\setminus S$ for some finite set $S\subset U$.
WLOG assume $T$ contains exactly 0 or 1 point in $S$, since otherwise subdivide $T$ into triangles small enough that each one has 0 or 1 point in $S$. If $T$ has 0 point in $S$, then we are done by the previous case.
Let $\set{a} = S \cap T$. For any triangle $T'\subseteq T$ containing $a$, we can decompose $T$ into a union of triangles $\set{T_i}$ with one of which being $T'$.
By positively orienting them, $\partial T = \sum_{i} \partial T_i$. Moreover by the previous case, $\int_{\partial T_i} f = 0$ except when $T_i = T'$, so $$ \begin{align*} \int_{\partial T} f ={}& \int_{\partial T'} f \\ \implies \left|\int_{\partial T} f\right| \leq{} & \mathrm{length}(\partial T') \cdot \sup_{\partial T'} |f| \\ \leq{} & \mathrm{length}(\partial T') \cdot \sup_{T} |f|. \end{align*} $$ By continuity of $f$, $\sup_T |f|$ is bounded. Since we can make $\mathrm{length}(\partial T')$ arbitrarily small, $\int_{\partial T} f = 0$.