For a Samsung Galaxy S4:
Go to settings, my device, blocking mode and check "disable notifications." you can go further down to set the time to block the notifications. This is what I use for at night so my phone doesn't make a noise every time I get an email.
If you want to silence the sound it makes when pressing keys while texting, it's a little more involved. Go to settings, my device, scroll down to input and control and then language and input. Even if you don't have it chosen (I have Google voice typing checked), click on the right side of Samsung keyboard, scroll down to advanced and uncheck key-tap sound, which is the very last option.