Gluing Lemma when A and B aren't both closed or open. Gluing Lemma:
$Let X = A \cup B \text{ and } f: A \rightarrow Y$ be continuous and $g: B \rightarrow Y$ be continuous with $A,B$ closed. Also $\left.f\right|_{A \cap B} = \left.g\right|_{A \cap B}$. Then $h: x \rightarrow y$ such that $\left.h\right|_A = f$ and $\left.h\right|_B = G$ is continuous.
I'm looking for an example of maps and sets when this fails if (without loss of generality) A is not closed and B is closed. 
Thanks in advance.  
 A: The relevant part here is that $A\cap B$ can be empty and yet have have the functions need to agree at the boundary of one because it's a limit point of the other. Let $A=[0,1]$ and $B=(1,2)$. Then $A\cup B=[0,2)$. Let $f(x)=x$ and $g(x)=-x$. Then $h(x)$ is discontinuous at $1$. But the criterion that they agree on the intersection is true, since the intersection is empty. Compare this with what happens with similar endpoints if both $A$ and $B$ are open (or both closed).
For an example with a nonempty intersection, consider $S^1$, the circle in $\mathbb{C}$. I will write $[\alpha,\beta]$ to mean arc starting at $\alpha$ and going clounterclockwise to $\beta$ closed, and with $()$ to denote open arcs.
Let $$A=(0,i),\quad B=[i,e^{\frac{i\pi}{4}}]$$
So $A$ is an open quarter circle and $B$ is a closed seven-eigths of a circle such that they share an endpoint. Notice that the two arcs over lap. This however does not force continuity because we still have the same issue at $i$ that we had at $1$ in the previous problem.
