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 / 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 / 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>
@jkeck
jkeck / gist:3515705
Created August 29, 2012 17:07 — forked from MrDys/gist:3512455
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id and is classed with modal and permalink:
<div class="modal permalink" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
'.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 / _fimlstrip.html.erb
Last active January 3, 2016 10:09
SearchWorks Filmstrip Example
<div class="filmstrip-container">
<div class="filmstrip-total"><%= link_to("View #{pluralize(document.total_collection_members, "item")} in this collection online", catalog_index_path(:f=>{:collection=>[document[:id]]}, :view=>"gallery")) %></div>
<div class="scroll-control disabled" data-direction="left"></div>
<div class="scroll-control" data-direction="right"></div>
<div class="filmstrip" data-preview-container='true'>
<ul>
<%- document.children.each do |doc| -%>
<%- unless doc.image_urls.blank? -%>
<li>
<div>
@jkeck
jkeck / access_log-20131201
Created December 5, 2013 00:59
All 403 errors from the apache access log on 2013-12-01
/users/jvine-drupal HTTP/1.1" 403 7482
/users/jvine-drupal HTTP/1.1" 403 7482 "http://libweb-test.stanford.edu/user" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/tech%20desk%20banner.jpg HTTP/1.1" 403 7536
/sites/default/files/styles/large/public/tech%20desk%20banner.jpg HTTP/1.1" 403 7536 "http://libweb-test.stanford.edu/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/disc.png HTTP/1.1" 403 7525
/sites/default/files/styles/large/public/disc.png HTTP/1.1" 403 7525 "http://libweb-test.stanford.edu/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/computer_0.png HTTP/1.1" 403 6941
/sites/default/files/styles/large/public/computer_0.png HTTP/1.1" 403 6941 "http://libweb-test.stanford.ed
@jkeck
jkeck / form_ext.rb
Created January 8, 2013 21:31
This would live in the lib directory of a gem. That gem would also provide some JS and some sort of controller logic about how to handle the data / form fields.
module FormExt
module FormHelper
def self.included(arg)
ActionView::Helpers::FormBuilder.send(:include, FormExt::FormBuilder)
end
def multi_valued_text_field_tag(object_name, method, options = {})
output = ''
if options and options[:value] and options[:value].is_a?(Array)
options.merge!(:"data-multivalued" => true)
options[:value].each_with_index do |value, index|
def get_addl_item_info(bcode,building,document)
# we need to have ON-ORDER records dealt with even though they don't have a barcode
if doc_on_order?(document)
return {:request_status => true, :status => "unavailable"}
else
if document.respond_to?(:holdings_from_solr)
unless document["item_display"].nil? or bcode.strip.blank?
return mod_item(bcode,building,document,document.holdings_from_solr[bcode.strip.to_sym]) if document.holdings_from_solr.has_key?(bcode.strip.to_sym)
end
end