Skip to content

Instantly share code, notes, and snippets.

Avatar

Colin grosscol

View GitHub Profile
@grosscol
grosscol / copy_node_btw_docs
Last active Aug 29, 2015
Nokogiri copy node between documents and DOMException WRONG_DOCUMENT_ERR
View copy_node_btw_docs
require 'nokogiri'
# The following illustrates unexpected behavior of the Nokogiri::XML::Document.add_child method.
# When called from a new document, the behavior is different depending on if the argument
# is a newly created node or duplicate node.
# String of XML for Nokogiri to parse.
dummy_xml = '<?xml version="1.0" encoding="UTF-8"?>
<root>
<Dummy>Text1</Dummy>
@grosscol
grosscol / active-fedora 9 demo
Last active Aug 29, 2015
ActiveFedora9 persisting to Fedora4 beta
View active-fedora 9 demo
# Simple ActiveFedora9 (Fedora4) Example
# Make sure hyda-jetty, using the fedora-4/edge branch, is running (rake jetty:start)
require "active_fedora"
class Dum < ActiveFedora::Base
# The Hydra convention is to minimally have descriptive and rights metadata.
# The Fedora4 paradigm is to define properties directly on the object as opposed to the datastreams of Fedora3
property :title, predicate: ::RDF::DC.title
@grosscol
grosscol / SHSViking Date Comparisons
Last active Aug 29, 2015
A naive implementation of doing some counting after data logic for a list of dates and a given source data frame.
View SHSViking Date Comparisons
# Generate your list of dates
mydays <- seq.Date( as.Date('2015-01-01'), as.Date('2015-03-09'), by="day")
# Write function to sum the number of open dates that occur in sourceData at least 31 days prior to given date.
numOpenDates <- function( givenDate ){
retValue <- sum( (givenDate - sourceDate$openDate) > 30 )
retValue
}
# Apply function to each date in your list of dates(mydays)
@grosscol
grosscol / 1086 rspec fails
Last active Aug 29, 2015
Sufia pcdm_1086 fails.
View 1086 rspec 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'
View gist:8b95c83a07d3a1772ca6
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 / gist:c9254b3c89d276c7cacd
Created Jun 10, 2015
Ldp::HttpError 500 from Sufia PCDM
View gist:c9254b3c89d276c7cacd
Ldp::HttpError in CurationConcern::GenericWorksController#create
STATUS: 500 ...
Extracted source (around line #108):
106
107
108
109
110
111
@grosscol
grosscol / ErrorLog
Created Jun 19, 2015
Ldp::HttpError 500 from Sufia pcdm logged
View ErrorLog
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 / EmpyWork Error Log
Created Jun 19, 2015
Error log resulting from attempt to create empty work.
View EmpyWork Error Log
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
View gist:d55224b39f24ff839a97
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,
View permissions_helper.md
       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 ?

You can’t perform that action at this time.