-
Install XCode
-
Install Command Line Tools from XCode Preferences
-
Install Homebrew
-
Install rvm or rbenv
-
Install Matterhorn dependencies within Homebrew
View bitstream-from-sub.py
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
#!/usr/bin/env python | |
# Find the raw bitstring from a captured Flipper RAW .sub file. | |
# Must provide the bitlength in ms, and the allowable error which can be tolerated. | |
import re | |
import sys | |
import math | |
filename = sys.argv[1] |
View tiny_tds_wrapper.rb
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
class TinyTdsWrapper | |
def initialize(config) | |
@config = config | |
@client = nil | |
end | |
def method_missing(method_name, *args, &block) | |
connect! | |
begin | |
@client.send(method_name, *args, &block) |
View net-http-debug.rb
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 'net/http' | |
# $ cat http_requests.log | grep "GET /" | wc -l | |
class BacktraceLogger | |
def initialize | |
end | |
def << ( s ) | |
open | |
@@file.write s |
View remove_protocol_from_url.rb
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 'uri' | |
url = 'http://google.com/' | |
def remove_protocol_from_url( url ) | |
url = url[2..-1] if url.start_with?('//') | |
uri = URI(url) | |
if scheme = uri.scheme | |
url = url[scheme.length + 3..-1] # :// is 3 bytes |
View file.js
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
var child = parent.open(); | |
$(child.document).find('body').append("Some text"); |
View gist:5910653
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
after_save do |record| | |
record.remove_relationship(:is_manager) | |
record.add_relationship(:is_manager, "info:fedora/#{record.collection.id}") | |
end |
View gist:5901432
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
def active_for_controller controller_name | |
params[:controller].to_s == controller_name.to_s ? 'active' : '' | |
end | |
def active_for_action action_name | |
params[:action].to_s == action_name.to_s ? 'active' : '' | |
end | |
Usage: | |
View controller
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
class RolesController < ApplicationController | |
include Hydra::RoleManagement::RolesBehavior | |
prepend_before_filter :accept_batches, only: [:destroy] | |
def destroy | |
@roles.each {|role| role.destroy} | |
redirect_to roles_path, notice: "Successfully deleted groups: #{params[:ids].join(", ")}" | |
end |
View gist:5708693
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
[147] pry(main)> ActiveFedora::Base.send( :find_one, 'avalon:692', { cast: true }) | |
=> #<MasterFile:3210659936578975662 @pid="avalon:692" > | |
[148] pry(main)> ActiveFedora::Base.send( :find_one, 'avalon:692', { cast: true }).class | |
=> MasterFile |
View Matterhorn Install.markdown