Skip to content

Instantly share code, notes, and snippets.

@sephlietz
sephlietz / gist:8892395
Created Feb 9, 2014
Check if two positive integers will result in an overflow
View gist:8892395
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));
}
@sephlietz
sephlietz / Rakefile
Created Feb 18, 2014
Rake tasks to deploy jekyll build with rsync
View Rakefile
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')
View AppThatUsesRetry.scala
import scala.concurrent.duration._
object AppThatUsesRetry extends App {
Retry(backoff = 30 seconds) {
throw new Exception("fail every 30 seconds")
}
}