Instantly share code, notes, and snippets.

View atom-snippet.cson
'.source.ruby':
'initialize':
'prefix': 'init'
'body': """
def initialize($1)
$2
end$3
"""
'require':
'prefix': 'req'
View spotlight-iiif-proposal.md

In order to support IIIF cropping of multi-image objects (which is currently supported in a non-IIIF way), we'll need to use IIIF manifests. Storing a list of info.json URLs will not be sufficient since the URL typically contains the file name of the item (at least in our case). This is potentially volatile in the case of remediations that changes file names. A IIIF manifest has references to the images contained within an object (as well as unique identifiers that we can use that will not change during remediation). This will require some changes that are outlined below.

Persisted Data

Currently we persist the URL to the masthead/thumbnail image itself (the act of submitting a crop selection for a masthead/thumbnail causes a fetch of the full image and does the image cropping server side). We still want to persist a URL to an image so we don't have to hit the IIIF service to get the cropped image URL, however we will need to persist some other data from the IIIF manifest to ensure that we're referencin

View test_faraday_timeout.rb
require 'faraday'
conn = Faraday.new(url: 'http://localhost:3000') do |faraday|
faraday.request :url_encoded
faraday.response :logger
faraday.adapter Faraday.default_adapter
faraday.request :multipart
end
conn.post do |req|
View svg-pie-chart.css
svg {
width: 100px;
border-radius: 50%;
background:yellowgreen;
transform: rotate(-90deg);
}
circle {
fill: none;
stroke-width: 32;
View form.html
<!-- Example: http://stanford.edu/~jkeck/sw-search.html -->
<form action="http://searchworks.stanford.edu/" method="get">
<label for="q">SearchWorks</label>
<input type="text" name="q" id="q" />
<input type="submit" value="Search" />
</form>
View app.rb
config.libraries = {
'ARS' => 'Archive of Recorded Sound',
'ART' => 'Art & Architecture Library',
'BIOLOGY' => 'Biology Library (Falconer)',
'BUSINESS' => 'Business Library',
'CHEMCHMENG' => 'Chemistry & ChemEng Library (Swain)',
'CLASSICS' => 'Classics Library',
'EARTH-SCI' => 'Earth Sciences Library (Branner)',
'EAST-ASIA' => 'East Asia Library',
'EDUCATION' => 'Education Library (Cubberley)',
View blacklight-customization.md

Basic Configuration

  • i18n (a lot of view overrides could be accomplished with i18n overrides)
  • blacklight_config (Controller Configuration)
    • Facets
    • Fields
    • Sorts
    • Search fields (search type drop-down)
    • Thumbnail by field

Advanced Configuration

View gist:b63922dc5a66fa368eba
(function($) {
/*
jQuery plugin to render Google book covers for image elements
Usage: $(selector).renderGoogleBookCovers();
This plugin :
- collects all 'img.cover-image' elements and batches them
- using ISBN, OCLC & LCCN value(s) of image elements inside each batch,
Google cover images are added using Google Books API
View export.rb
def initialize(controller, response_docs)
@controller = controller
@response_docs = response_docs
end
def blacklight_maps_config
@controller.blacklight_config.view.maps
end
def type
View gist:9334756
configure_blacklight do |config|
config.default_solr_params = {
:qt => 'search',
:qf => 'id content url title anchor author',
:rows => 10,
:"hl.fl" => "content",
:"hl.simple.pre" => '<span class="label label-info">',
:"hl.simple.post" => "</span>",
:hl => true
}