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
class SmthWitUrl < ActiveRecord::Base | |
validates_format_of :url, :with => URI.regexp(['http', 'https']) | |
end |
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
Autotest.add_hook :initialize do |at| | |
unless ARGV.empty? | |
at.find_directories = [] | |
at.extra_files = ARGV.dup | |
end | |
end |
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
def error_messages_for(object) | |
object = instance_variable_get("@#{object}") | |
return if object.errors.empty? | |
result = "<div id=\"errorExplanation\"><h2>The following errors prohibited this form from being saved:</h2><ul>" | |
object.errors.full_messages.each { |msg| result << "<li>#{msg}</li>" } | |
result << "</ul></div>" | |
result.html_safe | |
end |
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
<FilesMatch "\.atom"> | |
AddDefaultCharset UTF-8 | |
ForceType application/atom+xml | |
</FilesMatch> | |
<FilesMatch "\.atom"> | |
ForceType 'application/atom+xml; charset=UTF-8' | |
</FilesMatch> |
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
#ifdef RUBY_18 | |
# define STR(x) (RSTRING(x)->ptr) | |
# define LEN(x) (RSTRING(x)->len) | |
# define STR_AUX_CAPA(x) (RSTRING(buf)->aux.capa) | |
# define SET_STR_LEN(x, i) (RSTRING(x)->len = i) | |
# define FLOAT(f) (RFLOAT(f)->value) | |
# define ARRAY(a) (RARRAY(a)->ptr) | |
# define ARRAY_LEN(a) (RARRAY(a)->len) |
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
#ifdef RUBY_18 | |
# include "rubyio.h" | |
# include "intern.h" | |
#else | |
# include "ruby/io.h" | |
# include "ruby/intern.h" | |
#endif |
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
$CFLAGS << ' -DRUBY_18' if RUBY_VERSION =~ /1.8/ |
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
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
if forked | |
# We're in smart spawning mode. | |
else | |
# We're in conservative spawning mode. We don't need to do anything. | |
end | |
end | |
end |
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
I18n.t("foo.bar"); // -> "baz" | |
I18n.t("nested.hash"); // -> "value" | |
I18n.t("message.times", {count: 3}); // -> "3 times" |
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 Translations = { | |
locale: 'ru', | |
"foo.bar": "baz", | |
nested: { | |
hash: "value" | |
}, | |
message: { | |
times: "{{count}} times" |