Stone-Weierstrass: Examples By Stone-Weierstrass one has: $f\in\mathcal{C}(K):\quad p_n\to f$
Now, for analytic functions this is just Taylor:
$$f\in\mathcal{C}^\omega([a,b]):\quad f(x)=\sum_{k=0}^\infty a_kx^k$$
But, how does this work for other examples like:
$$K:=[-1,1]:\quad f(x):=|x|$$
$$L:=[-1,-\frac12]\cup[\frac12,1]:\quad g(x):=\frac{1}{x}$$
(Note that the latter is over a disconnected space.)
 A: 
how does this work for other examples  

Not via a Taylor series, that's for sure. The difference between


*

*$f$ is the limit of a uniformly converging power series, 


and 


*$f$ is the limit of a uniformly converging sequence of polynomials 


is that partial sums of a power series are a very special kind of a sequence of polynomials: for every $k$, the coefficient of $x^k$ is the same in all polynomials of degree at least $k$. 
A nondifferentiable continuous function like $|x|$ can be approximated in the second sense but not the first. 
A: Let us recall the Lebesgue's proof of Weierstrass approximation theorem.
Step1. If we are able to provide a polynomial approximation for $|x|$ over $[-1,1]$ with an arbitrarily small uniform error, we can do the same for any continuous function over a closed interval.
Proof: Let $f(x)$ be a continuous function over $I=[0,1]$. Since $f(x)$ is uniformly continuous over $I$, for any $\varepsilon > 0$ there exists $n\in\mathbb{N}$ such that the difference between $f(x)$ and the spline through the points $(0,f(0)),\left(\frac{1}{n},f\left(\frac{1}{n}\right)\right),\ldots,\left(\frac{n-1}{n},f\left(\frac{n-1}{n}\right)\right),(1,f(1))$ is bounded by $\varepsilon$ in absolute value. Since any spline is just a linear combination with bounded coefficients of functions like $|x-\alpha|$ for some $\alpha\in I$, a uniform polynomial approximation for $|x|$ grants the existence of a uniform polynomial approximation for any continuous function.
Step2. To provide a uniform polynomial approximation for $|x|$, we may consider the truncated Taylor series for $\sqrt{1-y}$ in a neighbourhood of $y=0$, then evaluate it in $y=1-x^2$. As an alternative, a uniform approximation is given by a Fourier series:
$$ P_{2n}(x)\triangleq\frac{2}{\pi}-\sum_{j=1}^{n}\frac{4(-1)^j}{(4j^2-1)\pi}\,T_{2j}(x),$$
where $T_{2j}$ is a Chebyshev polynomial of the first kind and:
$$ \|P_{2n}(x)-|x|\|_{\infty} = P_{2n}(0) = \frac{2}{(2n+1)\pi}.$$

About the function defined over a disconnected domain $D$: it is sufficient to take a continuous function $g(x)$ over $E=\operatorname{Conv}(D)$ such that $g_{|D}\equiv f$, then approximate $g(x)$ over $E$.
A: As mentioned by Pedro Tamaroff Bernstein Polynomials do the job.
Consider for example:
$$f:[-1,1]\to\mathbb{R}:f(x):=|x|$$
Then the first six polynomials are:
$$B_1(x)=1$$
$$B_2(x)=\frac12(1+x^2)$$
$$B_3(x)=\frac12(1+x^2)$$
$$B_4(x)=\frac{1}{8}(3+6x^2-x^4)$$
$$B_5(x)=\frac{1}{8}(3+6x^2-x^4)$$
$$B_6(x)=\frac{1}{16}(5+15x^2-5x^4+x^6)$$
