This file contains hidden or 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
| <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | |
| "http://java.sun.com/dtd/web-app_2_3.dtd"> | |
| <web-app> | |
| <context-param> | |
| <param-name>rails.env</param-name> | |
| <param-value>production</param-value> | |
| </context-param> | |
| <context-param> |
This file contains hidden or 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
| gem 'factory_girl', :require => nil |
This file contains hidden or 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
| # session is not preserved between requests in integration tests (since 2.3.8) | |
| # https://rails.lighthouseapp.com/projects/8994/tickets/4941-session-is-not-preserved-between-requests-in-integration-tests | |
| # this monkey-fix deals with the issue and is based on the provided patch from | |
| # the above ticket. require in your test_helper or integration_test_helper ... | |
| require 'action_controller/session/abstract_store' | |
| module ActionController |
This file contains hidden or 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($) { | |
| var fixDialogAutoWidth = $.noop; | |
| if ( $.browser.msie ) { | |
| fixDialogAutoWidth = function(content) { | |
| var dialog = $(content).parent('.ui-dialog'); | |
| var width = dialog.innerWidth(); | |
| if ( width ) dialog.css('width', width); | |
| } | |
| } | |
This file contains hidden or 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
| # 1. update rvm loading in .bash_profile, by default it looks like : | |
| # [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
| if [ -s "$HOME/.rvmrc" ]; then | |
| source "$HOME/.rvmrc" | |
| fi # to have $rvm_path defined if set | |
| if [ -s "${rvm_path-$HOME/.rvm}/scripts/rvm" ]; then | |
| source "${rvm_path-$HOME/.rvm}/scripts/rvm" | |
| fi |
This file contains hidden or 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 simpleFormatRE1 = /\r\n?/g; | |
| var simpleFormatRE2 = /\n\n+/g; | |
| var simpleFormatRE3 = /([^\n]\n)(?=[^\n])/g; | |
| function simpleFormat(str) { | |
| var fstr = str; | |
| fstr = fstr.replace(simpleFormatRE1, "\n") // \r\n and \r -> \n | |
| fstr = fstr.replace(simpleFormatRE2, "</p>\n\n<p>") // 2+ newline -> paragraph | |
| fstr = fstr.replace(simpleFormatRE3, "$1<br/>") // 1 newline -> br | |
| fstr = "<p>" + fstr + "</p>"; | |
| return fstr; |
This file contains hidden or 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
| module DelayedJobAware | |
| def self.delayed_worker? | |
| Thread.current[:delayed_worker_started] | |
| end | |
| # returns the Delayed::Worker.logger if inside a DJ process/thread | |
| # otherwise returns the default Rails.logger | |
| def self.current_logger |
This file contains hidden or 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
| /* | |
| * Adapted from Autogrow Textarea Plugin | |
| * @see http://www.technoreply.com/autogrow-textarea-plugin/ | |
| */ | |
| (function($) { | |
| $.fn.autoGrow = function() { | |
| return this.each(function() { | |
| var txtArea = $(this); | |
| var colsDefault = txtArea.attr('cols'); | |
| var rowsDefault = txtArea.attr('rows'); |
This file contains hidden or 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
| /** | |
| * Very handly (not just) for Rails : | |
| * | |
| * 1. setup RoR input method naming convention : | |
| * | |
| * $.fn.changeFormMethod.inputName = '_method'; | |
| * | |
| * 2. Any time You need to change Your forms method : | |
| * (e.g. re-using forms new forms for edit-ation) | |
| * |
This file contains hidden or 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 'java' | |
| class JRubySecurityManager < java.lang.SecurityManager | |
| def checkPermission( perm ) | |
| puts perm.inspect | |
| end | |
| end | |
| java.lang.System.setSecurityManager( JRubySecurityManager.new ) |