Skip to content

Instantly share code, notes, and snippets.

@jrochkind
jrochkind / gist:1030231
Created June 16, 2011 20:45
Blacklight unstemmed_overrides, with relevant solrconfig.xml
# These are over-rides sent to Solr when in :unstemmed_search mode
# They need to be kind of carefully calibrated with the settings in Solr
# and Blacklight for individual search types, sorry it's a bit fragile.
config[:unstemmed_overrides] = {
"title_qf" => [
"title1_unstem^80",
"title2_unstem^60",
"title3_unstem^30",
"title_series_unstem^25"
@jrochkind
jrochkind / gist:1038232
Created June 21, 2011 16:25
my (rails2) blacklight_config.rb as of now
# You can configure Blacklight from here.
#
# Blacklight.configure(:environment) do |config| end
#
# :shared (or leave it blank) is used by all environments.
# You can override a shared key by using that key in a particular
# environment's configuration.
#
# If you have no configuration beyond :shared for an environment, you
# do not need to call configure() for that envirnoment.
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0'
gem 'blacklight', :path => "./blacklight"
gem "blacklight_range_limit" #, :path => "./blacklight_range_limit"
gem "blacklight_advanced_search" #, :path => "./blacklight_advanced_search"
gem "blacklight_cql", ">=1.0.1" #, :path => "./blacklight_cql"
@jrochkind
jrochkind / example1.html
Created September 22, 2011 17:38
alternate format examples
<!DOCTYPE html>
<html>
<head>
<title>Alternate format link microdata: Example 1</title>
</head>
<body>
<div itemscope>
<p>Alice in Wonderland, by Lewis Caroll</p>
@jrochkind
jrochkind / a_with_itemprop_and_rel.html
Created September 22, 2011 20:13
html5 examples which do not validate
<!DOCTYPE html>
<html>
<head>
<title>Does not validate: 'a' with both 'itemprop' and 'rel'</title>
</head>
<body>
<div itemscope>
@jrochkind
jrochkind / gist:1236211
Created September 22, 2011 22:19
blacklight new config
self.blacklight_config.configure do
default_solr_params = { :qt => "search", :per_page => 10 }
# a couple weeks ago, we talked about trying to DRY these.
config.show.html_title = "title_display"
config.show.heading = "title_display"
config.show.display_type = "format"
# Under a better DSL, the above could look something like:
ruby-1.8.7-p302 :015 > module V1
ruby-1.8.7-p302 :016?> class Controller
ruby-1.8.7-p302 :017?> def something
ruby-1.8.7-p302 :018?> "something"
ruby-1.8.7-p302 :019?> end
ruby-1.8.7-p302 :020?> end
ruby-1.8.7-p302 :021?> end
=> nil
ruby-1.8.7-p302 :022 > module V2
ruby-1.8.7-p302 :023?> include V1
#NOW we do this, in our plugin app/helpers
module CatalogHelper
def actual_methods
'stuff'
end
end
# This is very hard to over-ride in a sensible way in local app.
# Instead, if we split things up:
[rochkind@xs001 bl3-gem]$ ./test_support/bin/test.sh 1.8.7
Using /home/rochkind/.rvm/gems/ruby-1.8.7-p352
exist
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
@jrochkind
jrochkind / gist:1305162
Created October 21, 2011 22:32
add links to github from rubydoc.info docs in the 'github' area.
if (match = window.location.pathname.match(/^\/github\/([^\/]+\/[^/]+)\/([^/]+)/)) {
var github_project = match[1];
var github_commit = match[2];
$(".source_code").each( function() {
if (match = $(this).find(".info.file").text().match(/^# File '([^']+)', line (\d+)/)) {
var file = match[1];
var line = match[2];
var url = "https://github.com/" + github_project +