Showing that a metric space is discrete if and only if any function from it to another metric space is continuous
Suppose every $f: (X,d) \to (Y,p)$ is continuous.
First let $y_0 \neq y_1 \in Y$, which exist by assumption. So $r = d(y_0,y_1) > 0$. Define $U_0 = B_p(y_0, \frac{r}{2}), U_1 = B_p(y_1, \frac{r}{2})$, these are open and disjoint (by the triangle inequality).
Let $A \subseteq X$. Then define $f_A: X \to Y$ by $f(x) = y_0$ for $x \in A$, $f(x) = y_1$ for $x \notin A$. By assumption this is continuous.
Note that $A = f^{-1}[U_0]$ (all $x \in A$ map to $y_0 \in U_0$ and all other $x$ map to $y_1 \notin U_0$). So $A$ is open, as the inverse image of an open set.
As $A$ was arbitrary, all subsets of $X$ are open, i.e. $X$ has the discrete topology.
Of $Y$ we only used it has a 2-point discrete subspace $\{y_0, y_1\}$, of $X$ nothing of the metric.