I am wondering if there is a residue-trick for computing $\int_{0}^{\infty}e^{-x^{2}}\cos(x^{2})\mathrm{d}x$ without having to go through computing the Gaussian residue integral.
For practice here is the Gaussian way, any corrections are appreciated. We will prove $\int_{\mathbb{R}} e^{-x^{2}c}\mathrm{d}x=\sqrt{\frac{\pi }{c}}$ with $\text{Re}(c)>0$.
Step 1
Following the same procedure as in http://www.math.uconn.edu/~kconrad/blurbs/analysis/gaussianintegral.pdf
we need a $\tau$ so $e^{2\tau^{2}c}=1$ to ensure $d(0)=d(\tau)$ and thus $f(z)-f(z+\tau)=e^{-z^{2}c}$. Thus, $$\tau=\sqrt{\frac{\pi }{2c}}(1+i).$$
So $e^{-\tau^{2}c}=-1$ and thus $f(z)=\dfrac{e^{-z^{2}c}}{1+e^{-2c\tau z}}$.
Step 2
Because $\tau=\sqrt{\frac{\pi }{2c}}(1+i)=\sqrt{\frac{\pi}{r}}\cos(\frac{\pi }{4}-\frac{\theta}{2})+i\sqrt{\frac{\pi}{r}}\sin(\frac{\pi }{4}-\frac{\theta}{2})$, where $c=re^{i\theta}$, for the contour we choose height $ib=i\sqrt{\frac{\pi}{r}}\sin(\frac{\pi }{4}-\frac{\theta}{2})$. Then the pole $\frac{\tau}{2}$ is inside it.
Step 3
The residue yields
$$\int_{\text{Rectangle}} \dfrac{e^{-z^{2}c}}{1+e^{-2c\tau z}}\mathrm{d}z=2\pi i \lim_{z\to \frac{\tau}{2}} \dfrac{e^{-z^{2}c}}{(-2c\tau)e^{-2c\tau z}}=\sqrt{\frac{\pi }{c}},$$
which is what we expected.
Step 4
On the other hand, $$\int_{\mathbb{R}} f(x)\mathrm{d}x-\int_{-\infty+ib}^{\infty+ib}f(z)\mathrm{d}z=\int_{\mathbb{R}} f(x)\mathrm{d}x-\int_{-\infty}^{\infty}f(x+ib)\mathrm{d}x$$
by rewriting $ib=\tau-\text{Re}(\tau)$ and translating we obtain
$$=\int_{\mathbb{R}} f(x)\mathrm{d}x-\int_{-\infty}^{\infty}f(x+\tau)\mathrm{d}x=\int e^{-x^{2}c}\mathrm{d}x.$$
Therefore, in our case $c=1\pm i$ and in turn
$$\int_{0}^{\infty}e^{-x^{2}}\cos(x^{2})\mathrm{d}x=\frac{1}{4}\left(\sqrt{\frac{\pi }{1+i}}+\sqrt{\frac{\pi }{1-i}})=\frac{\sqrt{\pi}}{2\sqrt[4]{2}}(\cos\left(\frac{\pi}{8}\right)\right).$$