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 / 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: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 / 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 / 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 / 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 / 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 / Failures
Created July 15, 2013 15:21
Failing search tests
[cjcolvar@localhost avalon]$ rspec spec/controllers/catalog_controller_spec.rb
Run options: exclude {:scaffold=>true}
..FF..FF
Failures:
1) CatalogController#index as an un-authenticated user should not show results for items that are not published
Failure/Error: assigns(:document_list).count.should eql(0)
expected: 0
@cjcolvar
cjcolvar / gist:6021472
Created July 17, 2013 15:11
bugfix/search merged into HH-6 test failures
Failures:
1) CatalogController#index as an un-authenticated user should show results for items that are public and published
Failure/Error: assigns(:document_list).count.should eql(1)
expected: 1
got: 0
(compared using eql?)
# ./spec/controllers/catalog_controller_spec.rb:11:in `block (4 levels) in <top (required)>'
@cjcolvar
cjcolvar / gist:6055470
Created July 22, 2013 16:49
fix for AMS loading 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 / gist:6186776
Created August 8, 2013 17:32
Adding field_changed? methods to AF delegations
diff --git a/lib/active_fedora/delegating.rb b/lib/active_fedora/delegating.rb
index d2a3a29..d805514 100644
--- a/lib/active_fedora/delegating.rb
+++ b/lib/active_fedora/delegating.rb
@@ -72,6 +72,7 @@ module ActiveFedora
if ds_specs.has_key? to.to_s
create_delegate_reader(fields.first, options)
create_delegate_setter(fields.first, options)
+ create_delegate_changed?(fields.first, options)
else