-
The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]
-
jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]
-
Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]
-
The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]
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 'dry-validation' | |
require 'active_model' | |
require 'benchmark' | |
schema = Class.new(Dry::Validation::Schema) do | |
key(:name, &:filled?) | |
key(:age) { |v| v.int? & v.gt?(18) } | |
end.new | |
class User |
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
Calculating ------------------------------------- | |
type-safe users 273.000 i/100ms | |
ar user models 257.000 i/100ms | |
------------------------------------------------- | |
type-safe users 2.813k (± 1.7%) i/s - 14.196k | |
ar user models 2.574k (±10.7%) i/s - 12.850k | |
Comparison: | |
type-safe users: 2812.7 i/s | |
ar user models: 2574.2 i/s - 1.09x slower |
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 extract_log(dir) | |
`(cd #{dir} && git log --oneline --shortstat --pretty=format:%aE)` | |
end | |
def extract_stats(log_string) | |
log_string.split(/\n\n/).map do |log_entry| | |
StatEntry.new log_entry | |
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
require 'benchmark/ips' | |
class Foo | |
def bar | |
1 | |
end | |
end | |
foo = Foo.new |
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
#!/bin/sh | |
if [ $# -eq 1 ] | |
then | |
VEID=$1 | |
echo -n "space...: " | |
USAGE=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $2}') | |
SOFTLIMIT=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $3}') | |
HARDLIMIT=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $4}') |
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
module MailQueue | |
extend self | |
def queue | |
:default | |
end | |
def perform(mailer_class, method, *args) | |
mailer = const_get mailer_class | |
mailer.send(method, *args).deliver |
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
=# gem install simple_form | |
= simple_form_for @article do |f| | |
= f.association :research, :prompt => 'select' |
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
#!/bin/bash | |
# A generator for a nicely tweaked rsnapshot configuration | |
# it collects in and exclude from rsnapshot files in the VZ and the Host roots. | |
# such files could look like following: | |
# > cat /rsnapshot | |
# / | |
# !/var/log | |
# !/tmp |
NewerOlder