Skip to content

Instantly share code, notes, and snippets.

Avatar

Colin grosscol

View GitHub Profile
View characterization.md
+        terms = characterization_terms
         Sufia.config.fits_to_desc_mapping.each_pair do |k, v|
-          if terms.has_key?(k)
-            # coerce to array to remove a conditional
-            terms[k] = [terms[k]] unless terms[k].is_a? Array
-            terms[k].each do |term_value|
-              proxy_term = self.send(v)
-              if proxy_term.kind_of?(Array)
-                proxy_term << term_value unless proxy_term.include?(term_value)
View io_delegator_example.rb
require 'delegator'
require 'stringio'
Class IoDelegator < SimpleDelegator
attr :mime_type, :original_name
end
a = StringIO.new
b = IoDelegator.new(b)
@grosscol
grosscol / af-noid_encoding_woes.rb
Last active Aug 29, 2015
AF NOID writing to state file elicits complaints from rails.
View af-noid_encoding_woes.rb
# Make a new rails application and drop this file in.
#
# Run from the command line with just plain ruby:
# bundle exec ruby doit.rb
#
# Run from the command line with rails:
# bundle exec rails runner "eval(File.read 'doit.rb')"
require 'active_fedora/noid'
@grosscol
grosscol / more_noid_woes.rb
Created Aug 10, 2015
More NOID minting woes with File io
View more_noid_woes.rb
# Make a new rails application and drop this file in.
#
# Run from the command line with just plain ruby:
# bundle exec ruby doit.rb
#
# Run from the command line with rails:
# bundle exec rails runner "eval(File.read 'doit.rb')"
require 'active_fedora/noid'
@grosscol
grosscol / tang.sh
Created Sep 10, 2015
Piece of bashrc for dev on tang.
View tang.sh
# If logging into tang, cd to dev
if [[ $HOSTNAME = 'tang.umdl.umich.edu' ]]; then
# Add rbenv init script evaluation
eval "$(rbenv init -)"
# Set rbenv version for this shell
rbenv shell 2.2.1
# Alias bundle exec as bunx
alias bunx='bundle exec'
# Change to dev directory
cd /quod-dev/dev/grosscol
@grosscol
grosscol / ecr.log
Created Nov 6, 2015
Engine Cart Regenerate log
View ecr.log
Removing sample rails app
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
@grosscol
grosscol / umich_dev_solr.xml
Last active Jan 8, 2016
Hackish Solr4 solr.xml
View umich_dev_solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
View solr.xml
<?xml version="1.0" encoding="UTF-8" ?>
<solr>
<sharedLib>lib</sharedLib>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:15000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
@grosscol
grosscol / analytics_spec_fail
Created Jan 27, 2016
analytics_spec_fail for sufia7 master
View analytics_spec_fail
13) Admin::StatsController statistics page top formats gathers formats
Failure/Error: json = open(query_url).read
ActionView::Template::Error:
404 Not Found
# ./app/models/system_stats.rb:99:in `top_data'
# ./app/models/system_stats.rb:57:in `top_formats'
# ./app/presenters/sufia/admin_stats_presenter.rb:22:in `top_formats'
# ./app/views/admin/stats/_top_data.html.erb:9:in `__home_grosscol_workspace_sufia_app_views_admin_stats__top_data_html_erb___3059809105315880374_47081691704000'
# ./app/views/admin/stats/index.html.erb:9:in `__home_grosscol_workspace_sufia_app_views_admin_stats_index_html_erb__4280599541274542522_47081693780540'
View rescueme.rb
(-5..5).each do |v|
begin
puts 10 / v
rescue => e
puts "#{e.message}"
next
end
end
You can’t perform that action at this time.