" Does there exist a continuous function $f: \mathbb{R} \to \mathbb{R}$ so that $\lim_{x \to \infty} f(x)=1$ and $\lim_{x \to -\infty}f(x)=-1$ and the function is not uniformly continuous on $\mathbb{R}$?"
I wanted to prove that this is impossible because it implies that the function has a horizontal asymptote. I tried to prove:
Take $\epsilon$>0 randomly.
Because $\lim_{x \to \infty} f(x)=1$ there exist an $N\in \mathbb{R}$ so that $|f(x)-1|<\epsilon/2$ for $x>N$.
Because $\lim_{x \to -\infty} f(x)=-1$ there exist an $M\in \mathbb{R}$ so that $|f(x)+1|<\epsilon/2$ for $x<M$.
Because $f$ is continous in $\mathbb{R}$ we take $a \in \mathbb{R}$. There exist a $\delta>0$ so that for $x \in \mathbb{R}$ , $|f(x)-f(a)|<\epsilon$ for $|x-a|<\delta$.
And this is were it gets hard. I thougt you can define a $\delta_{2}=\max\{N,M\}$. Take $x,y$ random in $\mathbb{R}$ so that $|x-y|<\delta_{2}$. Then $|f(x)-f(y)|=|f(x)-1+1-f(y)|=|f(x)-1|+|1-f(y)|<\epsilon$
I don't know if I defined my $\delta_{2}$ correctly. Can someone help me how to prove this correctly?
The function $\displaystyle\frac{x^{1/3}}{1+|x^{1/3}|}$ which has a vertical tangent line at the origin.
Ok, this one does not deserve credit, it is wrong, but will edit this to make it right... if possible
So let me make it right. There is no such function.
Proof. Take any $\varepsilon>0.$ Take $M>0$ such that $|f(x)+1|<\frac\varepsilon3$ if $x\le-M$, and such that $|f(x)-1|<\frac\varepsilon3$ if $x\ge M$.
Since $[-M,M]$ is compact (i.e., closed and bounded interval in this context), $f$ is uniformly continuous on this interval, and there is $\delta>0$ such that for $x,x'\in[-M,M]$ if $|x-x'|<\delta$ then we have $|f(x)-f(x')|<\frac\varepsilon3$.
Then for any $x,x'\in(-\infty,\infty)$ if $|x-x'|<\delta$ we have $|f(x)-f(x')|<\varepsilon$, that is, $f$ must be uniformly continuous on $(-\infty,\infty)$.
The inequality $|f(x)-f(x')|<\varepsilon$ is easy to verify considering cases... will not list them all, but one of the interesting ones (though they all are easy) is say $x\le M \le x'$ (and we may also assume that $\delta<M$ for convenience and without loss of generality).
So assume $x\le M \le x'$ and $|x-x'|<\delta$ (and hence $0<x$).
Then $|f(x)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-f(x')|\le$
$\le|f(x)-f(M)|+|f(M)-1|+|f(x')-1|<$
$<\frac\varepsilon3+\frac\varepsilon3+\frac\varepsilon3=\varepsilon$.
Thus $|f(x)-f(x')|<\varepsilon$.
Now that I posted my answer and read more of the comments, I see that what @questmath put in a comment, starting with
"$f$ is uniformly continuous on $[M,N]$..."
already provides (a clear enough hint for) the answer. I realize I only provided the details of a similar answer (with my notation being a bit different than what OP was asking, but I will keep it this way).
For that matter I also missed the very first comment, by @Surb (just read it, and understood what it says), already voted up three times because it is right and has what is needed...