This file contains 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
# in config/initializers | |
module ActionView | |
module Template::Handlers | |
class Prawn < Template::Handler | |
include ActionView::Template::Handlers::Compilable | |
self.default_format = Mime::PDF | |
def compile(template) |
This file contains 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
#!/usr/bin/env ruby | |
# Usage | |
# ./deploy [staging|production] <options> | |
# | |
# Options | |
# -m or --maintenance - Put the application into maintenance mode | |
# -b or --branch - deploy from a branch other than "master" | |
if ['staging', 'production'].include? ARGV[0] |
This file contains 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
require "test/unit" | |
include Test::Unit::Assertions | |
# Given an array_of_ints, find the highest_product you can get from three of the integers. | |
# The input array_of_ints will always have at least three integers. | |
# First attempt. O(n log(n)) (from sort), O(1) space. Bad, though, because it didn't handle negative numbers. | |
# def highest_product(array_of_ints) |