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
function viddlerVideoSwitch(objectElement, newId) { | |
viddlerVideoInterface(objectElement, function(movie){ | |
movie.setMovie(videoId, true); | |
}, function(video){ | |
video = $(video); | |
var src = video.attr('src'); | |
var poster = video.attr('poster'); | |
var oldId = src.match(/file\/([^\/]+)\/html5/)[1]; | |
var oldIdRegexp = new RegExp(oldId); | |
video.attr('src', src.replace(oldIdRegexp, newId)); |
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
$(document).ready(function(){ | |
// All links with class delete | |
$('.delete').click(function(event){ | |
// This should work--if cancel is pressed, it returns false, canceling | |
// the click. I haven't tested it out myself, though. | |
return confirm("Are you sure you want to delete this item?"); | |
}); | |
}); |
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
# Pretty sure you can't do a range of numbers like ([01-31]) | |
# Instead, you'll have to do ([0-3]?[0-9]): | |
# I also condensed the separate years into one rule | |
#RewriteEngine On | |
#RedirectMatch 301 /(2006|2007|2008|2009)/([0-1]?[0-9])/([0-3]?[0-9]))/(.*)$ http://old.bleikamp.com/$1/$2/$3/$4 | |
#Ok, here's an updated one: | |
RewriteEngine On |
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
# Helpful stuff from: http://chrisblunt.com/blog/2009/04/18/rails-writing-dry-custom-validators/ | |
ActiveRecord::Base.class_eval do | |
def self.validates_as_file(*attr_names) | |
options = {:max_size => 1, :extensions => '.txt'}.merge(attr_names.extract_options!) | |
options[:extensions] = [options[:extensions]] unless options[:extensions].is_a?(Array) | |
validates_each(attr_names, options) do |record, attr_name, value| | |
unless value.is_a?(Tempfile) | |
record.errors.add(attr_name, 'must be a file') |