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 ApplicationResponder < ActionController::Responder | |
def to_json | |
if has_errors? | |
display_errors | |
elsif save? || destroy? | |
render action: :show | |
else | |
super | |
end |
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 delegate_with_hash(to, array_of_hashes) | |
array_of_hashes.each do |h| | |
methods = Array[h.delete(:methods)] | |
delegate methods, h.merge(:to => to) | |
end | |
end |
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
cd `dirname $0`/.. && java -cp lib/jruby-core-1.6.2.jar:lib/jruby-stdlib-1.6.2.jar:lib/gems.jar org.jruby.Main -S rake "$@" RAILS_ENV=cron |
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
Rake::TaskManager.class_eval do | |
def delete_task(task_name) | |
@tasks.delete(task_name.to_s) | |
end | |
Rake.application.delete_task("db:test:prepare") | |
Rake.application.delete_task("db:test:purge") | |
end | |
namespace :db do | |
namespace :test do |
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 'ftools' | |
SPOTLIGHT_REGEX = "Z:/Active Projects/ASI JetCenter/FlashSpotlight/[^.]*.swf" | |
SPOTLIGHT_Z = Dir.glob SPOTLIGHT_REGEX | |
SPOTLIGHT_WEB = "flash/newjets.swf" | |
file SPOTLIGHT_WEB => SPOTLIGHT_Z do | |
if SPOTLIGHT_Z.length > 1 | |
puts "Error: more than one files found that match regex" | |
puts " - " + SPOTLIGHT_REGEX | |
else |
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
<cfcomponent display="RESTfulFilter" extends="MachII.framework.EventFilter"> | |
<cffunction name="filterEvent" returnType="boolean"> | |
<cfargument name="event" type="MachII.framework.Event" required="true" /> | |
<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" /> | |
<cfargument name="paramArgs" type="struct" required="false" default="#StructNew()#" /> | |
<cfset var requestMethod = cgi.REQUEST_METHOD /> | |
<cfset var _method = arguments.event.getArg("_method", requestMethod) /> | |
<cfset var restMethod = "" /> | |
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
FileUtils.rm_r takes an array | |
tmpfiles = Dir.glob("./**/.tmp") | |
FileUtils.rm_r tmpfiles | |
mp3files = Dir.glob("c:/**/*.mp3") | |
#the two ** == recursive | |
mp3files.each{|file| do_something_with(file) } |
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
@echo off | |
cd C:\OpenSSL\bin | |
:: inputting store number | |
:inputStoreNumber | |
set sStoreNumber= | |
set /P sStoreNumber=Store #: %=% | |
if "%sStoreNumber%"=="" goto inputStoreNumber | |
:: inputting store password |
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
$("a[href][rel*=external]").each(function() { | |
$(this).attr("target", "_blank"); | |
}); |
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
$("input[type=text][title]").each(function() { | |
$(this).val($(this).attr("title")); | |
if($.trim($(this).val()) == "") | |
$(this).val($(this).attr("title")); | |
$(this).focus(function() { | |
if($(this).val() == $(this).attr("title")) | |
$(this).val(""); | |
}).blur(function() { | |
if($.trim($(this).val()) == "") |