This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.time.LocalDate; | |
import java.time.ZoneId; | |
import java.util.Date; | |
/** | |
* This pattern has the following benefits: | |
* | |
* - Date formats are referenced as a strong type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDate; | |
import java.time.ZoneId; | |
import java.time.format.DateTimeFormatter; | |
import java.util.Date; | |
/** | |
* This pattern has the following benefits: | |
* | |
* - Date formats are referenced as a strong type | |
* - Code completion on patterns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exception notifier (rails3) only works as a rack middleware, | |
# but what if you need notifications inside a rake task or a script? | |
# This is a quick hack around that. | |
# | |
# Wrap your code inside an exception_notify block and you will be notified of exceptions | |
# | |
# exception_notify { clear_payments } | |
def exception_notify | |
yield | |
rescue Exception => exception |