Skip to content

Instantly share code, notes, and snippets.

View tobyclemson's full-sized avatar

Tobias Clemson tobyclemson

View GitHub Profile
describe FlowPreprocessor, "#initialize" do
before(:all) do
Timestamp = mock('timestamp class')
end
end
File.open(@input_file_path, 'r') do |input_file|
while raw_flow = input_file.gets
begin
flow = Flow.new(raw_flow)
rescue ArgumentError
@logger.error("Malformed flow.")
next
end
require 'open-uri'
require 'fastercsv'
class ZoneFinder
# Creates a ZoneFinder object
def initialize(network_data_path)
@network_data_path = network_data_path
end
def self.available_languages_codes
available_languages_columns.inject([]) do |codes, column|
codes << column.to_s.gsub(/content_/, '')
end
end
module AuthenticatedSystem
protected
...
def access_denied
respond_to do |format|
format.html do
store_location
@tobyclemson
tobyclemson / gist:838759
Created February 22, 2011 14:40
A thing of beauty!
private <S, T extends S> void replace(
List<S> elements,
Class<T> classOfElementsToRemove,
Class<? extends T> classOfElementToAdd) {
elements.removeAll(toList(filterByType(elements, classOfElementsToRemove)));
try {
elements.add(classOfElementToAdd.newInstance());
} catch (InstantiationException exception) {
throw new RuntimeException(exception);
} catch (IllegalAccessException exception) {
module Visitors
class PartialViewVisitor
def initialize description
@description = AddressableObjectTree.new(description)
@view = AddressableObjectTree.new({})
@cursor = Address.new
end
def view
@view.unwrap
Unsupported parameter type: class [Ljava.lang.CharSequence;
Faraday: you may want to install system_timer for reliable timeouts
*** Using highline effectively in JRuby requires manually installing the ffi-ncurses gem.
*** jruby -S gem install ffi-ncurses
file:/Users/tclemson/.gradle/caches/artifacts-15/filestore/org.rubygems/travis/1.0.2/jar/e27714fc43ba67b9ce631b53dfe7b3bc5156c5d2/travis-1.0.2.jar!/gems/travis-1.0.2/lib/travis/cli/parser.rb:29 warning: multiple values for a block parameter (2 for 1)
NameError: undefined local variable or method `slug' for Travis::CLI::RepoCommand:Class
RepoCommand at file:/Users/tclemson/.gradle/caches/artifacts-15/filestore/org.rubygems/travis/1.0.2/jar/e27714fc43ba67b9ce631b53dfe7b3bc5156c5d2/travis-1.0.2.jar!/gems/travis-1.0.2/lib/travis/cli/repo_command.rb:7
call at org/jruby/RubyProc.java:270
call at org/jruby/RubyProc.java:220
(ns provision
(:require [pallet.api :as api])
(:use [pallet.crate.automated-admin-user :only [with-automated-admin-user]])
(def application-nodes
(api/group-spec "application"
:extends [with-automated-admin-user]
:node-spec ubuntu-node))
(ns rosettajvm.deployment.crate.rosetta-jvm
(:require [pallet.configure :as configure])
(:use [pallet.api :only [plan-fn server-spec]]
[pallet.crate :only [defplan]]
[pallet.actions :only [remote-file]]))
(defplan fetch-service-artifact
"Fetch the RosettaJVM service artifact for the provided commit SHA"
[commit-sha]
(clojure.tools.logging/debugf "Fetching RosettaJVM service artifact with SHA %s" commit-sha)