Skip to content

Instantly share code, notes, and snippets.

View jkeck's full-sized avatar
:shipit:

Jessie Keck jkeck

:shipit:
View GitHub Profile
<%= some_text("LOCATION1") %>
<!-- This will only load once, and fail upon refresh -->
<html>
<body>
<%= some_method %>
</body>
</html>
#this is your output buffer simulated in a hash
mybuffer = {"1"=>[{:parser_first_name=>"abc",:parser_last_name=>"xyz",:parser_bday=>"jan1"},
{:parser_first_name=>"def",:parser_last_name=>"lmn",:parser_bday=>"feb1"}],
"2"=>[{:parser_first_name=>"amy",:parser_last_name=>"morgan",:parser_bday=>"may1"},
{:parser_first_name=>"nick",:parser_last_name=>"cary",:parser_bday=>"may6"}]
}
test_hash = {}
mybuffer.each do |groupid,people|
people.each do |person|
# Entering in tabs as \t so that it's easier to understand where the tab
mybuffer = "1\tabc\txyz\tjan1
\tdef\tlmn\tfeb1
2\tamy\tmorgan\tmay1
\tnick\tcary\tmay6"
test_hash = {}
gid = ""
#Split on new line so each line
mybuffer.split(/\n/).each do |line|
#split the line on the \t (tab) character so that we have 4 columns (groupid, first name, last name, birthday)
<div id="searchbox">
<h2 class="search"><%= label_tag(:q, "Search ") %></h2>
<% form_tag root_path, :method => :get do %>
<span id="search_box_and_link">
<%= text_field_tag(:q, localized_params[:q], :class=>"search") %>
</span>
<noscript>
<%= label_tag(:search_field, " in ") %>
<%= select_tag(:search_field, options_for_select(search_fields, h(localized_params[:search_field])), :title => "Targeted search options") %>
</noscript>
class YourController < ApplicationController
def my_json
response, @document = get_solr_response_for_doc_id
render :text => @document.my_json, :layout => false
end
def our_json
response, @document = get_solr_response_for_doc_id
render :text => @document.export_as(:our_json), :layout => false
end
function migrate_views_panes(){
$views_panes = db_query("SELECT * FROM {panels_pane} WHERE type = 'views2'");
while($view_pane = db_fetch_object($views_panes)){
$config = unserialize($view_pane->configuration);
$view = views_get_view($view_pane->subtype);
$keys = array_keys($view->display["default"]->display_options["arguments"]);
$new_args = array();
foreach($keys as $i=>$key){
if($key != "group_nid"){
$new_args[$key] = $config["arguments"][$i];
require 'blacklight/catalog'
class CatalogController < ApplicationController
include Blacklight::Catalog
configure_blacklight do |config|
config.default_solr_params = {
:qt => "search",
:per_page => 20
}
Loading development environment (Rails 3.1.1)
ruby-1.8.7-p334 :001 > CatalogController.new
NameError: undefined local variable or method `blacklight_config' for nil:NilClass
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/blacklight-3.2.1/app/helpers/blacklight/blacklight_helper_behavior.rb:97:in `index_fields'
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/blacklight-3.2.1/app/helpers/blacklight/blacklight_helper_behavior.rb:97:in `index_fields'
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/blacklight-3.2.1/lib/blacklight/utils.rb:11:in `send'
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/blacklight-3.2.1/lib/blacklight/utils.rb:11:in `[]'
from /Users/jkeck/.rvm/gems/ruby-1.8.7-p334@searchworks_rails3/gems/blacklight-3.2.1/lib/blacklight/configuration.rb:44:in `initialize_defaul
@jkeck
jkeck / README
Created May 4, 2012 21:59
Nearby on shelf
These are the flat files for Nearby on Shelf as implemented in SearchWorks.
I would like to turn this into an installable gem, however as a stop-gap measure for those interested in implementing nearby for themselves (or wants to run w/ this code an refactoring into a gem).
Some major areas of consideration are:
1) The current code gets sort keys and call numbers out of a delimited item_display field. These should be single configurable fields for each key.
2) jQuery for scrolling the nearby UI. We should really find a reliable 3rd party library for this kind of carrousel behavior.
3) There is some code revolving around checking barcodes. This should be refactored out in some way but I can't think of how.
4) The part of the NearbyOnShelf class initializer that takes action based on an "ajax" parameter seems wrong to me, but I can't think of a proper solution off the top of my head.
5) Several pieces of this will need to have a way of injecting HTML into the Blacklight UI. Changes to both Blacklight and