Skip to content

Instantly share code, notes, and snippets.

View grosscol's full-sized avatar

Colin grosscol

View GitHub Profile
@grosscol
grosscol / af-noid_encoding_woes.rb
Last active August 29, 2015 14:27
AF NOID writing to state file elicits complaints from rails.
# Make a new rails application and drop this file in.
#
# Run from the command line with just plain ruby:
# bundle exec ruby doit.rb
#
# Run from the command line with rails:
# bundle exec rails runner "eval(File.read 'doit.rb')"
require 'active_fedora/noid'
require 'delegator'
require 'stringio'
Class IoDelegator < SimpleDelegator
attr :mime_type, :original_name
end
a = StringIO.new
b = IoDelegator.new(b)
+        terms = characterization_terms
         Sufia.config.fits_to_desc_mapping.each_pair do |k, v|
-          if terms.has_key?(k)
-            # coerce to array to remove a conditional
-            terms[k] = [terms[k]] unless terms[k].is_a? Array
-            terms[k].each do |term_value|
-              proxy_term = self.send(v)
-              if proxy_term.kind_of?(Array)
-                proxy_term << term_value unless proxy_term.include?(term_value)
       def help_icon
-        content_tag 'i', '', :'aria-hidden' => true, class: 'help-icon'
+        content_tag 'i', '', 'aria-hidden' => true, class: 'help-icon'
       end

Can this be aria-hidden: true ?

CREATE TABLE `ingress` (
`ing_index` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`mrn` varchar(9) DEFAULT NULL,
`originalvial` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`ing_index`)
) ENGINE=InnoDB AUTO_INCREMENT=187434 DEFAULT CHARSET=utf8;
CREATE TABLE `norminv` (
`pni_index` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`mrn` varchar(9) DEFAULT NULL,
@grosscol
grosscol / EmpyWork Error Log
Created June 19, 2015 17:46
Error log resulting from attempt to create empty work.
Started POST "/works" for 127.0.0.1 at 2015-06-19 13:43:50 -0400
Processing by CurationConcern::GenericWorksController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"qL/V+XGs8GE8s0pwc5i30BZbuJP6xqVCMxp6YeRrnkKaZaTZrDW1+kKMx7mzd0zKggTy32dind3QeDxr7ExTNw==", "generic_work"=>{"resource_type"=>["", "Other"], "title"=>["EmptyWork"], "creator"=>["Colin A. Gross"], "contributor"=>[""], "description"=>[""], "tag"=>["blue"], "rights"=>["", "http://creativecommons.org/licenses/by/3.0/us/"], "publisher"=>[""], "date_created"=>[""], "subject"=>[""], "language"=>[""], "identifier"=>[""], "based_near"=>[""], "related_url"=>[""]}, "visibility"=>"open", "new_user_name_skel"=>"", "new_user_permission_skel"=>"none", "new_group_name_skel"=>"Select a group", "new_group_permission_skel"=>"none", "save_without_files"=>"Save without Files"}
User Load (4.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
(3.9ms) SELECT DISTINCT COUNT(DISTINCT "mailboxe
@grosscol
grosscol / ErrorLog
Created June 19, 2015 17:36
Ldp::HttpError 500 from Sufia pcdm logged
Started POST "/files" for 127.0.0.1 at 2015-06-19 13:33:25 -0400
Processing by GenericFilesController#create as JSON
Parameters: {"utf8"=>"✓", "authenticity_token"=>"n9jfvt5RMoUnka3usBxfJJzPtUh09+OK5tjR5f/FxX+tAq6eA8h3HlmuICdw86Q+CJD/BOlT2xUFupfv9+IICg==", "total_upload_size"=>"3458", "relative_path"=>"", "batch_id"=>"rj430457n", "work_id"=>"", "file_coming_from"=>"local", "terms_of_service"=>"1", "files"=>[#<ActionDispatch::Http::UploadedFile:0x007f36f3997718 @tempfile=#<Tempfile:/tmp/RackMultipart20150619-14610-1cuzuj7.txt>, @original_filename="teach_data_concepts.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"files[]\"; filename=\"teach_data_concepts.txt\"\r\nContent-Type: text/plain\r\n">]}
User Load (4.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
(3.6ms) SELECT DISTINCT COUNT(DISTINCT "mailboxer_conversations"."id") FROM "mailboxer_conversations" INNER JOIN "mailboxer_notifications" ON "mailboxer_no
@grosscol
grosscol / gist:c9254b3c89d276c7cacd
Created June 10, 2015 18:06
Ldp::HttpError 500 from Sufia PCDM
Ldp::HttpError in CurationConcern::GenericWorksController#create
STATUS: 500 ...
Extracted source (around line #108):
106
107
108
109
110
111
Failures:
1) CurationConcern::GenericWorkActor#create valid attributes with a file authenticated visibility should stamp each file with the access rights
Failure/Error: expect(subject.create).to be true
ActiveFedora::UnknownAttributeError:
GenericFile does not have an attribute `generic_work_id'
# /home/grosscol/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/active-fedora-9.1.1/lib/active_fedora/attributes.rb:103:in `array_setter'
# /home/grosscol/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/active-fedora-9.1.1/lib/active_fedora/attributes.rb:66:in `[]='
# /home/grosscol/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/active-fedora-9.1.1/lib/active_fedora/associations/has_many_association.rb:51:in `set_owner_attributes'
# /home/grosscol/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/active-fedora-9.1.1/lib/active_fedora/associations/has_many_association.rb:57:in `insert_record'
@grosscol
grosscol / 1086 rspec fails
Last active August 29, 2015 14:20
Sufia pcdm_1086 fails.
In feature branch to get GenericWork to top level class in Sufia, and
Sufia::Works::Work and Sufia::Works::Generic work as Concern in branch:
https://github.com/grosscol/sufia/tree/pcdm_1086
rspec Failures:
1) CurationConcern::GenericWorkActor#create valid attributes with a file authenticated visibility should stamp each file with the access rights
Failure/Error: expect(subject.create).to be true
ActiveFedora::UnknownAttributeError:
GenericFile does not have an attribute `generic_work_id'