Skip to content

Instantly share code, notes, and snippets.

View gist:65d179d79af4b771fe36
Library Electronic Resources Specialist
Raritan Valley Community College
Branchburg Township, New Jersey
ColdFusion, EZproxy, JavaScript, Personal computer hardware
Digital Scholarship Specialist
University of Oklahoma
Norman, Oklahoma
Digital humanities, University of Oklahoma
rsinger / file-input
Created Nov 4, 2013
Webkit file inputs style to look more or less like other form buttons
View file-input
input[type="file"]::-webkit-file-upload-button {
-webkit-appearance: button;
font-size: smaller;
View yaz-marcdump.bash
for f in *.dat ; do echo "Processing $f" ; yaz-marcdump -f MARC-8 -t UTF-8 -o marc -l 9=97 $f > ../loc_utf8_records/$f ; cd ../loc_utf8_records ; gzip $f ; cd ../loc_records ; done
rsinger / method_missing.rb
Created May 31, 2012
method_missing example
View method_missing.rb
class Foo
def method_missing(method_name, *args)
# method_name is a symbol
if method_name.to_s =~ /^find_by_/
self.find_by_magic_method(method_name, args)
elsif method_name.to_s =~ /^other_dynamic_method_/
self.do_other_dynamic_method(method_name, args)
# If we get here, we'll get a NoMethodError
rsinger / record.mrc
Created May 29, 2012
Record that seems to cause the LinkedList error
View record.mrc
<record xmlns="">
<leader>00488nam a2200193 4500</leader>
<controlfield tag="001">vtls002817361</controlfield>
<controlfield tag="003">WlAbNL</controlfield>
<controlfield tag="005">20060313054800.0</controlfield>
<controlfield tag="008">060313 || | ||| d</controlfield>
<datafield tag="016" ind1=" " ind2=" ">
<subfield code="a">FREPO</subfield>
<datafield tag="020" ind1=" " ind2=" ">
View datafield.rb
# to get the field as a string, without the tag and indicators
# useful in situations where you want a legible version of the field
# print record['245'].value
def value(delim='')
return( {|s| s.value}.join(delim))
rsinger / jcode19.rb
Created Oct 10, 2011
Dealing with jcode in 1.9
View jcode19.rb
if RUBY_VERSION < '1.9'
$KCODE = 'u'
require 'jcode'
View table.rb
DB.create_table :journals do
primary_key :id
string :title, :size=>1024, :index=>true
string :issn, :size=>8, :index=>true
string :e_issn, :size=>8, :index=>true
text :journal_url
text :publisher
View fuseki.rb
require 'httparty'
require 'rdf'
require 'rdf/ntriples'
require 'rdf/nquads'
require 'json'
class Fuseki
include HTTParty
headers 'Accept' => 'text/plain; charset=utf-8'
base_uri 'http://localhost:3030/'
View dbconn.rb
class DbConnection
require "jruby"
attr_reader :conn
require 'jdbc/sybase-jconnect-5.5.jar'
@@connection = nil
def initialize
import java.sql.Statement
import java.sql.Connection
import java.sql.SQLException