Skip to content

Instantly share code, notes, and snippets.

import scala.concurrent.duration._
object AppThatUsesRetry extends App {
Retry(backoff = 30 seconds) {
throw new Exception("fail every 30 seconds")
}
}
@sephlietz
sephlietz / Rakefile
Created February 18, 2014 17:05
Rake tasks to deploy jekyll build with rsync
desc "Build jekyll locally"
task :build do
sh "bundle exec jekyll build"
end
desc "Deploy _site"
task :deploy => :build do
user = 'user'
host = 'example.com'
release_dir = Time.new.strftime('%Y%m%d%H%M%S')
@sephlietz
sephlietz / gist:8892395
Created February 9, 2014 00:20
Check if two positive integers will result in an overflow
public boolean willPositiveIntegerAdditionOverflow(int a, int b) {
if (a < 0 || b < 0) {
throw new IllegalArgumentException("this only works with two positive integers");
}
return (a > (Integer.MAX_VALUE - b));
}