Skip to content

Instantly share code, notes, and snippets.

View mjgiarlo's full-sized avatar
:shipit:
always be shipping

Michael J. Giarlo mjgiarlo

:shipit:
always be shipping
View GitHub Profile
@mjgiarlo
mjgiarlo / gist:b817e303c68c062d77cb
Last active August 29, 2015 14:19
Carville on labor and love, from THE WAR ROOM

"There's a simple doctrine: outside of a person's love, the most sacred thing that they can give is their labor. And somehow or another along the way, we tend to forget that. Labor is a very precious thing that you have. Anytime that you can combine labor with love, you've made a good merger." -- http://www.imdb.com/title/tt0108515/quotes

[2] pry(main)> module Writable
[2] pry(main)* def permissions
[2] pry(main)* puts VALIDATIONS
[2] pry(main)* end
[2] pry(main)* VALIDATIONS = [1,2,3]
[2] pry(main)* end
[4] pry(main)> class Foo
[4] pry(main)* include Writable
[4] pry(main)* VALIDATIONS = [1,2]
@mjgiarlo
mjgiarlo / code.el
Created April 20, 2015 16:50
code configs in emacs
(setq my-code-modes-hook nil)
;; Color-code matching delimiters
(el-get 'sync '(rainbow-delimiters))
(add-hook 'my-code-modes-hook
(lambda () (rainbow-delimiters-mode 1)))
(autoload 'fci-mode "fill-column-indicator"
"Toggle fill column indicator"
t)
@mjgiarlo
mjgiarlo / gist:a212e104d22a69be5cf3
Created April 2, 2015 20:02
datetime comparison (strings vs. dates)
[1] pry(main)> dts1 = "2015-04-02T19:54:45.962Z"
=> "2015-04-02T19:54:45.962Z"
[2] pry(main)> dts2 = "2015-04-02T19:54:45.96Z"
=> "2015-04-02T19:54:45.96Z"
[3] pry(main)> dtd1 = DateTime.parse "2015-04-02T19:54:45.962Z"
=> #<DateTime: 2015-04-02T19:54:45+00:00 ((2457115j,71685s,962000000n),+0s,2299161j)>
[4] pry(main)> dtd2 = DateTime.parse "2015-04-02T19:54:45.96Z"
=> #<DateTime: 2015-04-02T19:54:45+00:00 ((2457115j,71685s,960000000n),+0s,2299161j)>
[5] pry(main)> dts1 > dts2
=> false
@mjgiarlo
mjgiarlo / travis traceback
Created April 2, 2015 18:42
Intermittent AF versioning error
1) a versionable rdf datastream that exists in the repository after creating the datastream two times should have two versions
Failure/Error: expect(subject.versions.all[index].label).to end_with "version"+(index+1).to_s
expected "version2" to end with "version1"
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectations/handler.rb:40:in `handle_failure'
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectations/handler.rb:27:in `with_matcher'
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
# ./gemfiles/vendor/bundle/ruby/2.1.0/gems/rspec-expectations-3.2.0/lib/rspec/expectati
@mjgiarlo
mjgiarlo / generic_file.rb
Created March 31, 2015 21:44
nrogers_art's GenericFile
class GenericFile < ActiveFedora::Base
include Sufia::GenericFile
# Add additional RDF properties for the Cleveland Museum of Art's needs
property :spatial, predicate: ::RDF::DC.spatial do |index|
index.as :stored_searchable, :facetable
end
property :coverage, predicate: ::RDF::DC.coverage do |index|
index.as :stored_searchable, :facetable
end
That's how I'm grokking it at the moment, yeah. So we'd have (all names provisional!):
* one Sufia::Work (a subclass of (Active)Fedora::Object) as the "thing" the user deposits (i.e., one-to-many files with one metadata record)
* containing one Sufia::LeafWork (a subclass of Sufia::Work, or directly of (Active)Fedora::Object) per submitted file
* each of which LeafWork in turn containing (via hasFile) one Sufia::File (a subclass of (Active)Fedora::Object) for the submitted blob and more Sufia::Files (via aggregates) for derivatives, FITS XML, full-text.
Like this:
/objects/work0 - the overarching "work," such as a multi-file ETD deposit (PDF, zipfile)
/objects/work0/members/work1 - the proxy to a "leaf work," wrapping the submitted PDF
Ride the MAX up to Washington Park and check out the rose garden and/or the Japanese garden up there. It's beautiful, peaceful, and only 10ish minutes away from downtown. On a sunny day you can catch glimpses of Mt. Hood! It may even get sunnyish towards Friday and Saturday.
There's also a cool Chinese garden in Chinatown, that I think has a little tea house on its grounds if you're up for some oolong.
If you're there on a Saturday, check out the Saturday market!
Get some local Portland-roasted coffee. Portland is a coffee town. Stumptown is the one I know best, but there are probably a dozen others that are also top-notch.
Get a weird donut at Voodoo donuts! The maple bacon is pretty good.
@mjgiarlo
mjgiarlo / gist:a15bc935ba26ab6723f2
Created January 2, 2015 03:52
Ldp::UnexpectedContentType on #reindex_everything
irb(main):008:0> ActiveFedora::Base.reindex_everything
Ldp::UnexpectedContentType: The resource http://127.0.0.1:8080/fedora/rest/prod/34/29/60/5c/3429605c-468b-41f4-81b0-ab6c0451b625/content is not an RDFSource
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/ldp-0.2.0/lib/ldp/response.rb:112:in `graph'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/ldp-0.2.0/lib/ldp/resource/rdf_source.rb:29:in `graph'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/active-fedora-9.0.0.beta8/lib/active_fedora/indexing.rb:82:in `get_descendent_uris'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/active-fedora-9.0.0.beta8/lib/active_fedora/indexing.rb:85:in `block in get_descendent_uris'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/active-fedora-9.0.0.beta8/lib/active_fedora/indexing.rb:84:in `each'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/active-fedora-9.0.0.beta8/lib/active_fedora/indexing.rb:84:in `get_descendent_uris'
from /opt/druw/vendor/bundle/ruby/2.1.0/gems/active-fedo
# spec failure
1) CurationConcern::GenericWorkActor#create valid attributes with a file authenticated visibility should stamp each file with t[1970/9118]
ights
Failure/Error: expect(generic_file.filename).to eq 'image.png'
expected: "image.png"
got: [""]
(compared using ==)