This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var params = $.request.params; | |
$.solr.query('a test', {per_page:10,page:params.page}, function(response){ | |
response.docs.each(function(doc){ | |
$('#docs').append(doc.id); | |
}) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\n\ Blacklight Template \n\n" | |
bl_dirname = 'blacklight' | |
plugin :blacklight, :git=>'git://github.com/projectblacklight/blacklight-plugin.git' | |
plugin :engines, :git=>'git://github.com/lazyatom/engines.git' | |
plugin :acts_as_taggable_on_steroids, :svn=>"http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids/" | |
plugin :resource_controller, :git=>'git://github.com/giraffesoft/resource_controller.git' | |
run "mv vendor/plugins/blacklight-plugin vendor/plugins/#{bl_dirname}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ArrayToHash | |
def to_hash | |
(size/2).times.inject({}) do |out,index| | |
out.merge self[index * 2] => self[index * 2 + 1] | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
search = 'rocket science' | |
results = open "http://virgobeta.lib.virginia.edu/catalog?q=#{URI.escape(search)}&qt=search" | |
components = ["Blacklight results for #{search}..."] | |
components += Nokogiri::XML(results).search('.document').map do |d| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :build do | |
def release_name | |
version = ENV['RELEASE_VERSION'].to_s.empty? ? nil : ENV['RELEASE_VERSION'] | |
raise "A RELEASE_VERSION is required." unless version | |
"release-#{version}" | |
end | |
# remove remote branch: | |
# git push origin :heads/<branch-name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line = "one|two|three\|xyz|four" | |
# line.split // | |
i_want_this = ['one', 'two', 'three\|xyz', 'four'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def a(b); puts b; end | |
instance_eval "def b arg; a(arg) end" | |
b 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyStuff | |
def something_important | |
execute 'select * from ...' | |
end | |
end | |
ActiveRecord::Base.connection.extend MyStuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module B | |
end | |
one = 1 | |
one.extend B | |
# results in "TypeError: can't define singleton" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def to_a_xml | |
:axml | |
end | |
end | |
module B | |