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 'ray' | |
class LazyObject < BasicObject | |
def initialize(&callback) | |
@callback = callback | |
end | |
def __result__ | |
@__result__ ||= @callback.call | |
end |
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
class DownloadManager | |
def initialize | |
@downloads = [] | |
end | |
def save(url, filename) | |
downloads << Lazy.future { File.binwrite(filename, open(url).read) } | |
end | |
def finish_all_downloads |
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
set nobackup | |
set nowritebackup | |
set noswapfile | |
set backspace=indent,eol,start | |
set history=50 " keep 50 lines of command line history | |
set ruler " show the cursor position all the time | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching |
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
[:id, :season, :episode].all? { |k| options.key?(k) } | |
raise ArgumentError, ":id, :season, and :episode are required" | |
end |
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
# From Bryan Liles on the Practicing Ruby Discussion List | |
1. TDD is a great tool. As a tool, you'll use it when appropriate. | |
TATFT mostly means that you should be thinking about how you can put | |
whatever you are creating under test at all times. Writing tests for | |
the sake of writing tests is silly. | |
2. Like Gregory stated, brittle tests aren't helping anyone. Think | |
about the ingress/egress points of your objects at all times. |