The integral of complex function is zero 
Let $f:\mathbb{C}\rightarrow \mathbb{C}$ be a continuous function on $\mathbb{C}$ and holomorphic in $\mathbb{C}\setminus \mathbb{R}$. Prove that for every closed curve $\gamma$: $\int_\gamma f(z)\,dz=0$.

So if $\gamma$ does not intersect $\mathbb{R}$ at all then we know that $\int_ \gamma f=0$  from Cauchy's theorem, but I don't know how to continue from here...

One thing you could do is define $F(z) = \int_{[0,z]}f(w)\,dw.$ If you can show $F'(z) = f(z)$ everywhere, then you'll know $F$ is entire, hence its derivative $f$ is entire. The conclusion then follows from Cauchy's theorem.
To get started, suppose $z$ is in the upper half plane $\mathbb H.$ Then $z+h\in \mathbb H$ if $|h|$ is small. Let $\Delta$ be the triangle $0,z,z+h.$ Then by continuity,
$$\tag 1 \int_\Delta f(w)\,dw = \lim_{\epsilon\to 0^+}  \int_{\Delta +i\epsilon} f(w)\,dw.$$
Since the triangle $\Delta +i\epsilon$ lies in $\mathbb H,$ where $f$ is holomorphic, the right side of $(1)$ is $0$ for every $\epsilon.$ Hence the left side of $(1)$ is $0.$
This allows you to claim $F(z+h) -F(z)$ is the integral of $f$ along $[z,z+h].$ The leads to $F'(z) = f(z)$ quite nicely.
The proof for the lower half plane is the same, and if $z\in \mathbb R,$ there are some cases to consider, but it's basically the same.
