Skip to content

Instantly share code, notes, and snippets.

View mwmitchell's full-sized avatar

Matt Mitchell mwmitchell

View GitHub Profile
$(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);
})
})
})
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}"
module ArrayToHash
def to_hash
(size/2).times.inject({}) do |out,index|
out.merge self[index * 2] => self[index * 2 + 1]
end
end
end
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|
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>
line = "one|two|three\|xyz|four"
# line.split //
i_want_this = ['one', 'two', 'three\|xyz', 'four']
def a(b); puts b; end
instance_eval "def b arg; a(arg) end"
b 1
module MyStuff
def something_important
execute 'select * from ...'
end
end
ActiveRecord::Base.connection.extend MyStuff
module B
end
one = 1
one.extend B
# results in "TypeError: can't define singleton"
module A
def to_a_xml
:axml
end
end
module B