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
#!/bin/bash | |
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile | |
# from https://github.com/tokuhirom/plenv#readme | |
PLENV_PERL_VERSION='5.18.1' | |
if [[ -n "$PERL_MB_OPT" ]]; then | |
echo "You must unset your local::lib environment variables first" |
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 "thread" | |
class BoundedQueue | |
def initialize(max_size = :infinite) | |
@lock = Mutex.new | |
@items = [] | |
@item_available = ConditionVariable.new | |
@max_size = max_size | |
@space_available = ConditionVariable.new | |
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
import org.marc4j.marc.Record; | |
import org.marc4j.marc.DataField; | |
import org.marc4j.marc.Subfield; | |
import org.solrmarc.tools.Utils; | |
// define the base level indexer so that its methods can be called from the script. | |
// note that the SolrIndexer code will set this value before the script methods are called. | |
org.solrmarc.index.SolrIndexer indexer = null; | |
// Max estimation -- biggest delta of unknown dates that we'll take the |
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
# | |
# Mirah REPL -- hacked to bits | |
# | |
# assuming your ruby is jruby, | |
# $ gem install mirah | |
# $ ruby -rubygems repl.rb | |
# m> class Foo | |
# m> def bar | |
# m> 12 | |
# m> end |
I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").
Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):
# minitest/spec.rb
module MiniTest::Expectations
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
# encoding: utf-8 | |
require 'java' | |
module JUC | |
java_import 'java.util.concurrent.Executors' | |
java_import 'java.util.concurrent.TimeUnit' | |
end |