UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.
Hello,
If you reached this page, means you've hit this SSL error when trying to
| #!/usr/bin/ruby | |
| # chkconfig: 35 99 01 | |
| # description: EC2 DNS registration | |
| # processname: ec2hostname | |
| require 'aws-sdk' | |
| require 'net/http' | |
| `touch /var/lock/subsys/ec2hostname` |
| #!/usr/bin/ruby | |
| # chkconfig: 35 99 01 | |
| # description: EC2 DNS loadbalancing | |
| # processname: ec2hostname | |
| require 'aws-sdk' | |
| require 'net/http' | |
| `touch /var/lock/subsys/ec2hostname` |
| def alias_task(name, old_name) | |
| t = Rake::Task[old_name] | |
| desc t.full_comment if t.full_comment | |
| task name, *t.arg_names do |_, args| | |
| # values_at is broken on Rake::TaskArguments | |
| args = t.arg_names.map { |a| args[a] } | |
| t.invoke(args) | |
| end | |
| end |
UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.
Hello,
If you reached this page, means you've hit this SSL error when trying to
| # blog post: http://blog.slashpoundbang.com/post/12694519460/email-validation-in-rails-3-or-active-model-without | |
| # http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/ | |
| class EmailValidator < ActiveModel::EachValidator | |
| # Domain must be present and have two or more parts. | |
| def validate_each(record, attribute, value) | |
| address = Mail::Address.new value | |
| record.errors[attribute] << (options[:message] || 'is invalid') unless (address.address == value && address.domain && address.__send__(:tree).domain.dot_atom_text.elements.size > 1 rescue false) | |
| end | |
| end |
Today we use computers to mask messages every day. When you connect to a website that uses "https" in the address, it is running a special encoding on your transmissions that makes it very difficult for anyone to listen in between you and the server.
| # each_with_index, each_with_object and inject({}) are all %50 slower then #each | |
| # simple each with an addition noop | |
| [4] pry(main)> puts Benchmark.measure { (1..10_000_000).each { |i| i + 1 } } | |
| 0.450000 0.000000 0.450000 ( 0.448808) | |
| # each_with_index | |
| [5] pry(main)> puts Benchmark.measure { (1..10_000_000).each_with_index { |i, index| i + 1 } } | |
| 0.650000 0.000000 0.650000 ( 0.645812) |
| require 'benchmark' | |
| N = 1000000 | |
| nums = N.times.map{ rand(N) } | |
| enum = [1, 2, 'string', {}, [], false, true, nil] | |
| def process(v) | |
| v | |
| end |
| @import "compass/css3/images"; | |
| // CSS-only multi-line ellipsis with generated content | |
| // yields `position:relative`, so remember to declare an eventual `position:absolute/fixed` *after* including this mixin | |
| @mixin limitLines( | |
| $maxLinesPortrait, // Mandatory: The number of lines after which the clipping should take action. | |
| $maxLinesLandscape: $maxLinesPortrait, // You may provide a different line limit for landscape orientation. | |
| // Note that 'portrait' is our default orientation. However, if you omit $maxLinesLandscape, | |
| // the value of $maxLinesPortrait is used for whatever orientation (that is, without a media query). |
| # Example of how to test a module included into multiple models | |
| require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper")) | |
| describe Featurable do | |
| class FeaturableObject | |
| include Featurable | |
| attr_accessor :sport, :featured_at |