Skip to content

Instantly share code, notes, and snippets.

@DanCoughlin
DanCoughlin / bashrc
Created September 19, 2012 18:37
gemset rvm release
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
@DanCoughlin
DanCoughlin / .profile
Created October 9, 2012 14:27
Profile
PATH=:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/X11R6/bin:/Applications/Utilities:$HOME/bin:/usr/local/fits-0.6.0:$PATH
# Tomcat, Java, Fedora settings
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home;
export JAVA_HOME;
# default shell settings
set -o vi
export LC_ALL=en_US.UTF-8
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
@DanCoughlin
DanCoughlin / gf-rspec
Created November 19, 2012 21:20
GF controller output
{"checksum_audit_log"=>{"actual_result"=>nil, "created_at"=>"2012-11-19T21:20:24Z", "dsid"=>"DC", "expected_result"=>nil, "id"=>35, "pass"=>1, "pid"=>"scholarsphere:bc386j20b", "updated_at"=>"2012-11-19T21:20:24Z", "version"=>"DC1.0"}}
{"checksum_audit_log"=>{"actual_result"=>nil, "created_at"=>"2012-11-19T21:20:24Z", "dsid"=>"RELS-EXT", "expected_result"=>nil, "id"=>36, "pass"=>1, "pid"=>"scholarsphere:bc386j20b", "updated_at"=>"2012-11-19T21:20:24Z", "version"=>"RELS-EXT.1"}}
{"checksum_audit_log"=>{"actual_result"=>nil, "created_at"=>"2012-11-19T21:20:24Z", "dsid"=>"RELS-EXT", "expected_result"=>nil, "id"=>36, "pass"=>1, "pid"=>"scholarsphere:bc386j20b", "updated_at"=>"2012-11-19T21:20:24Z", "version"=>"RELS-EXT.1"}}
{"checksum_audit_log"=>{"actual_result"=>nil, "created_at"=>"2012-11-19T21:20:24Z", "dsid"=>"rightsMetadata", "expected_result"=>nil, "id"=>37, "pass"=>1, "pid"=>"scholarsphere:bc386j20b", "updated_at"=>"2012-11-19T21:20:24Z", "version"=>"rightsMetadata.0"}}
{"checksum_audit_log"=>{"actual_res

ARCHITECTing ScholarSphere

ScholarSphere is a web application that allows the Penn State research community to deposit, share, and manage its scholarly works. It is also, as some of our users and our peers have observed, a repository app that feels much more like Google Docs or GitHub than earlier-generation repository applications. ScholarSphere is built upon the Hydra framework (Fedora Commons, Solr, Blacklight, Ruby on Rails), MySQL, Redis, Resque, FITS, ImageMagick, jQuery, Bootstrap, and FontAwesome. We'll talk about techniques we used to:

  • eliminate Fedora-isms in the application
    1. no objects
    2. no datastreams
    3. no namespaces in URLs
  • model and expose RDF metadata in ways that users find unobtrusive
  1. tradeoffs for using RDF instead of XML to serialize metadata
@DanCoughlin
DanCoughlin / seeds.rb
Last active February 12, 2021 11:27
Example of a database seed file for rails
# loop over this 5 times
5.times do |i|
# create a topic with the name provided name and description
t = Topic.create(title: "Topic ##{i}", description: "This topic is cool because everyone loves the topic number ##{i}.")
# create a random number between 1 and 100 and loop that many times create a vote for this topic
rand(1..100).times do |j|
t.votes.create
end
end
# create a user with this email address and password
@DanCoughlin
DanCoughlin / gist:e2e9b43e5834a986c4b2
Created April 30, 2015 00:11
Fixing style over ride for striped tables
.table-striped {
tbody {
tr:nth-child(odd) {
td {
background-color: rgba(255,255,255,0.1);
color: gray;
a {
color: white;
}
@DanCoughlin
DanCoughlin / gist:f97d719bb40855366e98
Created April 30, 2015 18:02
application.css.sass
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
@DanCoughlin
DanCoughlin / gist:e26bc99c74b2d75e5bac
Created August 12, 2015 15:45
Demonstration of creating cURL to get repos from archivespace
repo_id = 3
login_url = "http://<url to hit>/users/<user name to login as>/login"
repo_url = "http://<url to hit>/repositories/#{repo_id}/"
all_repos_url = "#{repo_url}/resources?all_ids=1"
ind_repo_url = "#{repo_url}/resources/"
c = Curl::Easy.http_post(login_url, Curl::PostField.content('password', '<config var>'))
json = JSON.parse(c.body_str)
token = json['session']
repos = Curl.get(all_repos_url) do |http|
http.headers['X-ArchivesSpace-Session'] = token
@DanCoughlin
DanCoughlin / week3challenge.sh
Created September 10, 2015 00:38
searching a file provided for key words provided and printing the number of times it has been found.
#!/bin/bash
# give counts for two different variables
# for any file passed
# and output the values
n1=`grep -i $1 $3 | wc -l`
n2=`grep -i $2 $3 | wc -l`
# output the values
echo In file: $3
echo I found $1 $n1 times