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
#per my process: I loaded all of this data into a normal ActiveRecord Table via a migration and with proper indexing. | |
# I looked at the request and response data needed for AWS per the docs, and limited them to only what I knew was required though | |
# the sdk gives a lot of metadata that could be useful in the future. I did not test this with an actual aws bucket, but per my understanding | |
# it only needs the bucket name and the name of the object in the bucket which was the report_uuid. This could obviously use an | |
#integration test, stubbed responses and an end-to-end test on the business necessary features. | |
# I like to write these kinds of data to temp folders if the data is likely to go stale quickly and need to be updated | |
# The use of private methods creates an easy to understand footprint for the report object so that a developer can quickly get | |
#either a collection of completed reports, or to find out if an instance of the class is completed. That's about it. Thanks. | |
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
1) Create a chef recipe that writes a hash from an attribute into a YAML file. | |
Well, it was going to take me too long to configure the entire chef environment on my local machine and I thought I would move on. It's not a particularly hard problem, since chef is easy to read and write coming from ruby. | |
Here is the solution I came up with, but I had no way of testing it locally. | |
#hash_to_yaml.rb | |
require 'yaml' | |
#ATTRIBUTE here can be substituted with any chef attribute hash. i.e. => (node[:cfn][:environment]) | |
#There was no way of calling that |
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
...............................F.............F..F.................................................................F........................................................................................................................................................................2014-04-25T00:40:51Z 33964 TID-ov7bqfw7w WARN: FinishTaskWorker: StateMachine::InvalidTransition: task: 12151, err: Cannot transition status via :finish from :created (Reason(s): Transition halted) | |
.. | |
Failures: | |
1) AudioFile basics should provide filename for remote url | |
Failure/Error: audio_file.filename.should eq 'test.wav' | |
expected: "test.wav" | |
got: "" |
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
2014-04-22T18:40:41.399675+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activemodel-3.2.17/lib/active_model/attribute_methods.rb:407:in `method_missing' | |
2014-04-22T18:40:41.399679+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.17/lib/active_record/attribute_methods.rb:149:in `method_missing' | |
2014-04-22T18:40:41.399680+00:00 app[web.1]: /app/app/models/image_file.rb:25:in `process_file' | |
2014-04-22T18:40:41.399683+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:409:in `_run__2091039910526197988__commit__2805964848685143992__callbacks' | |
2014-04-22T18:40:41.399684+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:405:in `__run_callback' | |
2014-04-22T18:40:41.399685+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.17/lib/active_support/callbacks.rb:385:in `_run_commit_callbacks' | |
2014-04-22T18:40:41.399687+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.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
module Feedzirra | |
module Parser | |
# Parser for dealing with RDF feed entries. | |
class MediaRSSEntry | |
include SAXMachine | |
include FeedEntryUtilities | |
element :title | |
element :link, :as => :url |
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 FeedPopUp | |
require 'uri' | |
require 'pathname' | |
# adding this for testing feed parsing in an easier way | |
attr_accessor :dry_run | |
def self.update_from_feed(feed_url, collection_id, dry_run=false) | |
feed_pop_up = FeedPopUp.new(dry_run) | |
feed_pop_up.parse(feed_url, collection_id) | |
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 FeedPopUp | |
require 'uri' | |
require 'pathname' | |
# adding this for testing feed parsing in an easier way | |
attr_accessor :dry_run | |
def self.update_from_feed(feed_url, collection_id, dry_run=false) | |
feed_pop_up = FeedPopUp.new(dry_run) | |
feed_pop_up.parse(feed_url, collection_id) | |
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
file_storage.rb | |
lines 42-58, | |
def update_file!(name, sid) | |
sid = sid.to_i | |
file_will_change! | |
raw_write_attribute(:file, name) | |
if (sid > 0) && (self.storage.id != sid) | |
# see if the item is right |
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 | |
DIRECTIONS =['N', 'E', 'S', 'W'] | |
class Hero | |
def initialize(x,y,direction) | |
@x = x | |
@y = y | |
@direction = direction | |
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
dbc20 chai (static_pages) $ git status | |
# On branch static_pages | |
# Changes not staged for commit: | |
# (use "git add/rm <file>..." to update what will be committed) | |
# (use "git checkout -- <file>..." to discard changes in working directory) | |
# | |
# modified: app/assets/stylesheets/application.css | |
# modified: app/views/contact/new.html.erb | |
# modified: app/views/layouts/application.html.erb | |
# deleted: app/views/pages/index.html.erb |
NewerOlder