Skip to content

Instantly share code, notes, and snippets.

View cjcolvar's full-sized avatar

Chris Colvard cjcolvar

  • Bloomington, IN
View GitHub Profile
@cjcolvar
cjcolvar / gist:5976510
Created July 11, 2013 15:33
AF::Base.delegate override to allow ActiveSupport's delegate
def self.delegate(*methods)
options = methods.last
if options.include?(:at) || options.include?(:unique)
super
else
Module.delegate(*methods)
end
end
@cjcolvar
cjcolvar / gist:5860032
Last active December 18, 2015 23:09
Test results
[cjcolvar@localhost avalon]$ rspec spec
/home/cjcolvar/.rvm/gems/ruby-1.9.3-p194@avalon/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
F.FF.FFF.FFFFFFFFFFFF*F.FFF.FF***F..F..FFFFF.FFF/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
F/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
F/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*/home/cjcolvar/Code/avalon/avalon/spec/lib/avalon/batch_ingest_spec.rb:26: warning: already initialized constant DropboxService
*......FFF..F...F...........F....**.**F**............*............*........*.....*...*...
@cjcolvar
cjcolvar / uniqueness_validator_spec.rb
Created June 18, 2013 16:06
spec/validators/uniqueness_validator_spec.rb
require 'spec_helper'
describe "UniquenessValidator" do
before(:all) do
@solr_field = "title_t"
@validator = UniquenessValidator.new({:attributes => {}, :solr_name => @solr_field})
@record = stub(pid:"avalon:2")
@record.stub("errors").and_return([])
@record.errors.stub('[]').and_return({})
@cjcolvar
cjcolvar / controller
Last active December 18, 2015 02:08
Batch delete example working with cancan's load_and_authorize_resource
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
@cjcolvar
cjcolvar / gist:5680449
Created May 30, 2013 19:27
Diff that hopefully fixes AMS preloading issue
diff --git a/src/flash/htmlelements/VideoElement.as b/src/flash/htmlelements/VideoElement.as
index 700ecdf..e1d460a 100644
--- a/src/flash/htmlelements/VideoElement.as
+++ b/src/flash/htmlelements/VideoElement.as
@@ -202,6 +202,14 @@ package htmlelements
sendEvent(HtmlMediaEvent.SEEKED);
break;
+ case "NetStream.Seek.Complete":
+ if (_isPreloading) {
@cjcolvar
cjcolvar / FlashMediaElement.as
Created May 24, 2013 17:39
Make audio be video in flash mediaelement.js when not mp3
+ //Force audio that isn't mp3s to video because the flash.media.Sound only handles mp3s
+ if (!_isVideo && _mediaUrl.indexOf("mp3") == -1)
+ _isVideo = true;
+
@cjcolvar
cjcolvar / gist:5620930
Created May 21, 2013 15:57
XACML policy combining algorithms (as described in some IBM documentation not the OASIS standard)
From the Dependent Policies Combining list, select the policy combining algorithm.
Deny Overrides
The deny-overrides policy-combining algorithm evaluates each policy in the order that it appears in the XACML policy set. If any policy in the set evaluates to deny, the policy combination evaluates immediately to deny. In other words a single deny takes precedence over other policy evaluations. If all policies are determined to be NotApplicable, the policy combination evaluates to NotApplicable.
First Applicable
(Default) The first-applicable policy combining algorithm evaluates each policy in the order that it appears in the XACML policy set. For an individual policy, if the target (resource) evaluates to TRUE and the policy conditions evaluate unambiguously to permit or deny, evaluation is immediately halted, and the policy combination evaluates to the effect of that individual policy. If the individual policy evaluates the target as FALSE or the policy conditions as NotApplicable, then the next poli
@cjcolvar
cjcolvar / gist:5585764
Created May 15, 2013 17:34
VideoElement.as.diff
diff --git a/src/flash/htmlelements/VideoElement.as b/src/flash/htmlelements/VideoElement.as
index 5a3e1ec..6f209cc 100644
--- a/src/flash/htmlelements/VideoElement.as
+++ b/src/flash/htmlelements/VideoElement.as
@@ -242,8 +242,12 @@ package htmlelements
if (_isPreloading) {
-
+ _stream.seek(0);
@cjcolvar
cjcolvar / gist:5577667
Created May 14, 2013 17:09
bootstrap_form_for undefined
Started GET "/roles/new" for 127.0.0.1 at 2013-05-14 13:04:31 -0400
Processing by RolesController#new as HTML
Rendered /home/cjcolvar/Code/avalon/hydra-role-management/app/views/roles/new.html.erb within layouts/blacklight (103.7ms)
Completed 500 Internal Server Error in 137ms
ActionView::Template::Error (undefined method `bootstrap_form_for' for #<#<Class:0x00000005ba59a0>:0x000000055cc998>):
1: <%= bootstrap_form_for @role, :url=>role_management.roles_path do |f| %>
2: <%= f.text_field :name, :label=> 'Role name' %>
3: <%= f.actions %>
4: <% end %>
@cjcolvar
cjcolvar / gist:5468837
Created April 26, 2013 17:21
Changes from puppet script for pawpaw
Changes from puppet script for pawpaw
Symlink /var/avalon to /srv/avalon
Comment out distribute-hls operation from avalon-video MH workflow
Shutdown red5
Stop MH, tomcat
Move /usr/local/matterhorn to /srv/avalon/matterhorn, edit MATTERHORN_HOME in /etc/init.d/matterhorn, restart MH
Move /usr/local/fedora to /srv/avalon/fedora, symlink back to /usr/local/fedora, restart tomcat