Skip to content

Instantly share code, notes, and snippets.

View jcoyne's full-sized avatar

Justin Coyne jcoyne

  • Stanford University Libraries
  • Minneapolis, MN
View GitHub Profile
2.0.0-p0 :006 > str
=> "fällen"
2.0.0-p0 :007 > m = Marshal.dump(str)
=> "\x04\bI\"\ff\xC3\xA4llen\x06:\x06ET"
2.0.0-p0 :008 > Marshal.load(m)
=> "fällen"
$ git reset --hard 7326feb5f7925991754ec2594ccf28c6c83613ec
HEAD is now at 7326feb Merge pull request #8 from mbklein/master
$ git status
# On branch master
# Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.
#
nothing to commit (working directory clean)
@jcoyne
jcoyne / gist:5502707
Created May 2, 2013 14:46
Esme's problem.
class XVocabulary < ActiveFedora::Base
has_many :x_vocabulary_entries, :property => :vocabularyEntry, :inverse_of => :x_vocabulary
end
=> #<Proc:0x007fbd056b4b20@/Users/justin/workspace/active_fedora/lib/active_fedora/associations.rb:265 (lambda)>
class XVocabularyEntry < ActiveFedora::Base
belongs_to :x_vocabulary, :property => 'dams:vocabulary', :inverse_of => :vocabulary
end
=> #<Proc:0x007fbd056d7dc8@/Users/justin/workspace/active_fedora/lib/active_fedora/associations.rb:275 (lambda)>
XVocabulary.create
module Hyhull
module Datastream
class WorkflowProperties < ActiveFedora::OmDatastream
set_terminology do |t|
t.root(:path=>"fields")
t.depositor
t.depositorEmail
t.collection
t.resource_state
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">2</int>
<lst name="params">
<str name="qf">creator_tesim</str>
<str name="wt">xml</str>
<str name="debugQuery">true</str>
<str name="q">Pernambuco, João </str>
>> ActiveFedora::Base.new.respond_to? :internal_uri
=> true
>> ModsArticle.new.respond_to? :internal_uri
=> true
>> class Foo < ModsArticle
>> end
=> nil
>> Foo.new.respond_to? :internal_uri
=> true
@jcoyne
jcoyne / gist:5777417
Created June 13, 2013 21:12
Collections in solr
f = GenericFile.first
=> #<GenericFile pid:"scholarsphere:r49507488"...
> f.collections
=> []
> c = Collection.new
=> #<Collection pid:""...
> c.apply_depositor_metadata('jcoyne')
=> true
> c.save
<pbcoreIdentifier source="ROW RECORD_ID" annotation="Filemaker Pro database file name + internal record ID">COMBO_03_18_rev_ab_lhw_021213JP.fp7:2498</pbcoreIdentifier>
<pbcoreIdentifier source="_recID" annotation="record metadata ID">2745</pbcoreIdentifier>
<pbcoreTitle titleType="Item">Terry Winograd Interview </pbcoreTitle>
<pbcoreRelation>
<pbcoreRelationType source="SOURCE_FILENAME">File Name</pbcoreRelationType>
<pbcoreRelationIdentifier>C0001.mov
C0002.mov
{"rack.version"=>[1, 2], "rack.input"=>#<StringIO:0x007fcf1ebbf5b8>, "rack.errors"=>#<StringIO:0x007fcf1c9f8d58>,
"rack.multithread"=>true, "rack.multiprocess"=>true, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET",
"SERVER_NAME"=>"example.org", "SERVER_PORT"=>"80", "QUERY_STRING"=>"datastream_id=webm", "rack.url_scheme"=>"http",
"HTTPS"=>"off", "SCRIPT_NAME"=>nil, "CONTENT_LENGTH"=>"0",
"action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x007fcf1b99a060>,
"action_dispatch.parameter_filter"=>[:password], "action_dispatch.redirect_filter"=>[],
"action_dispatch.secret_token"=>nil,
"action_dispatch.secret_key_base"=>"748f6ecaeb59883dba75568ed313194c7cffb12fbb447e3681116ce6c6f79bd8a096a459e520376ddc88ea116fefd853f2b37eae61d783e24319d7f4bdefb645",
"action_dispatch.show_exceptions"=>false, "action_dispatch.show_detailed_exceptions"=>true,
"action_dispatch.logger"=>#<ActiveSupport::Logger:0x007fcf1c905108 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fcf1c904fc8 @datetime_f
# This will produce two derivative datastreams 'avatar_medium' and 'avatar_thumb'. The original will be just 'avatar'
# has_file_datastream 'avatar', :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
#
# This will call a processor Transcoding::Ocr and store the text in 'document_text'
# has_file_datastream 'document', :styles => { :text => { :quality => :better } },
# :processors => [:ocr]
#
# process_in_background :avatar, queue: 'avatar'
# process_in_background :document, queue: 'extract_text'