Jonathan Rochkind jrochkind

View gist:8853450
1 2 3 4 5
old = hash[:a][:b]
 
hash[:a][:b] = hash[:a][:b].dup
 
hash[:a][:b].equal? old # shouldn't, but did somehow
View gist:8337160
1 2 3 4 5 6 7 8 9 10
$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
msel-sysmac05:blacklight jrochkind$ bundle install
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
View gist:7772683
1 2 3 4 5 6 7 8 9 10
source 'http://rubygems.org'
 
gem 'rails', '~> 3.2.0'
 
gem 'blacklight', :github => "projectblacklight/blacklight", :branch => "bootstrap3" #{}"~> 4.0.0" #, :path => "./blacklight"
gem 'kaminari'
 
gem 'marc', ">= 0.5.0"
 
# Not really a gem, but organized as a local gem, our marc
View gist:6715756
1 2 3 4 5 6 7 8 9 10
/* Custom JS for Advanced Search Form */
jQuery(document).ready(function($) {
// A utility function we'll use to make a JQuery selector
// on a particular string 'id'. HTML id allows : or . chars,
// but need to be escaped in JQuery selectors.
// See http://docs.jquery.com/Frequently_Asked_Questions#How%5Fdo%5FI%5Fselect%5Fan%5Felement%5Fby%5Fan%5FID%5Fthat%5Fhas%5Fcharacters%5Fused%5Fin%5FCSS%5Fnotation.3F
function jq_id_select_escape(str_id) {
return str_id.replace(/(:|\.)/g,'\\$1');
View gist:5920077

Just initial sketch, I'm SURE as I actually started to implement, some details would change--can't spec it all out in advance iron-clad.

I don't know what to call it, let's say sindexer

From the command line, you'd run:

sindex config_file.rb config_file2.rb -i input_marc.mrc

You can have multiple config files listed. Config files are plain old ruby (DSL), although they don't neccesarily need to look like that. If no -i argument, then it reads from STDIN.

View gist:5258055
1
?url_ver=Z39.88-2004&url_ctx_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Actx&ctx_ver=Z39.88-2004&ctx_tim=2013-03-27T17%3A09%3A55-04%3A00&ctx_id=&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rft.au=Oscar+Wilde&rft.aufirst=Oscar&rft.aulast=Wilde&rft.btitle=El+retrato+de+Dorian+Gray&rft.date=2005&rft.genre=book&rft.isbn=9788497644679&rft.place=Madrid&rft.pub=Edimat+Libros&rft.title=El+retrato+de+Dorian+Gray&rft.tpages=312&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft_id=info%3Aoclcnum%2F67836772&rft_id=urn%3Aasin%3A8497644670&rft_id=urn%3AISBN%3A9788497644679&rft_dat=<accession+number>67836772<%2Faccession+number><fssessid>fsapp8-53784-hesm03tl-fqm0i8<%2Ffssessid>&req.ip=128.220.8.101&rfr_id=info%3Asid%2FFirstSearch%3AWorldCat
View gist:5059963

"if no electronic version is found, offer to search for it in google scholar"

Why?

  • Find It sometimes provides no full text for a citation, when the paper cited is actually available on the public web for everyone, as PDF or HTML.
    • Because we don't have a licensed copy, but it's on the web for free
    • Or, because we do have a licensed copy, but SFX failed to find it (possibly because insufficient metadata was included in citation), and it's on the web for free too.
View gist:4726637
1 2 3 4 5 6 7 8
list.reject.each_with_index(item, index)
target_name = item[:sfx_target_name]
prefix = prefixes.find {|p| target_name.start_with?(p)}
prefix && list.slice(0,index).reverse.find do |candidate|
candidate[:sfx_target_name].start_with?(prefix)
end
end
View gist:4676862
1 2 3 4 5 6 7 8 9 10
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:prism="http://prismstandard.org/namespaces/basic/2.1/" xmlns:dcterms="http://purl.org/dc/terms/">
<id>http://test.host</id>
<title>Search Results</title>
<author>
<name>Search Results</name>
</author>
<opensearch:totalResults>1000</opensearch:totalResults>
<opensearch:startIndex>6</opensearch:startIndex>
<opensearch:itemsPerPage>15</opensearch:itemsPerPage>
Something went wrong with that request. Please try again.