Skip to content

Instantly share code, notes, and snippets.

View jkeck's full-sized avatar
:shipit:

Jessie Keck jkeck

:shipit:
View GitHub Profile
@jkeck
jkeck / snippet.html
Created February 14, 2020 21:04
HTML snippet that will show you which bootstrap breakpoint the browser is currently at
<div>
<span>Current breakpoint:</span>
<b class="d-sm-none">XS</b>
<b class="d-none d-sm-inline d-md-none">SM</b>
<b class="d-none d-md-inline d-lg-none">MD</b>
<b class="d-none d-lg-inline d-xl-none">LG</b>
<b class="d-none d-xl-inline">XL</b>
</div>
'.source.ruby':
'initialize':
'prefix': 'init'
'body': """
def initialize($1)
$2
end$3
"""
'require':
'prefix': 'req'
@jkeck
jkeck / spotlight-iiif-proposal.md
Last active January 13, 2017 19:36
A brief proposal (and some other notes) on implementing IIIF cropping in Spotlight

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

@jkeck
jkeck / test_faraday_timeout.rb
Last active May 18, 2016 17:50
Faraday Timeout Example
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|
@jkeck
jkeck / svg-pie-chart.css
Created November 14, 2015 06:22
Simple SVG Pie Chart
svg {
width: 100px;
border-radius: 50%;
background:yellowgreen;
transform: rotate(-90deg);
}
circle {
fill: none;
stroke-width: 32;
@jkeck
jkeck / form.html
Last active August 29, 2015 14:24
SearchWorks Search Form
<!-- 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>
@jkeck
jkeck / app.rb
Created April 17, 2015 18:12
Example configuration
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)',
@jkeck
jkeck / blacklight-customization.md
Last active August 29, 2015 14:16
Outline for Blacklight Customization Workshop at HydraConnect.

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

@jkeck
jkeck / gist:b63922dc5a66fa368eba
Created August 22, 2014 17:36
Proposed GBS change
(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
def initialize(controller, response_docs)
@controller = controller
@response_docs = response_docs
end
def blacklight_maps_config
@controller.blacklight_config.view.maps
end
def type