##Issue ffi/ffi#245
TypeError: no implicit conversion from nil to integer
##Platform
uname -a
Darwin dbutler.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
uname -a | |
Darwin dbutler-mac-2.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 |
##Issue ffi/ffi#245
TypeError: no implicit conversion from nil to integer
##Platform
uname -a
Darwin dbutler.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
# Tested in Ruby 1.8.7 | |
class ParentClass | |
def call_private_good | |
# Private methods can only be called without an explicit receiver | |
private_test | |
end | |
def call_private_bad | |
# Calling a private method with an explicit receiver (self) will fail |
rvm use jruby | |
gem install json | |
Successfully installed json-1.7.6-java | |
1 gem installed | |
# Uses JSON prepackaged with JRuby? | |
➜ ~ jruby -r 'json' -r 'active_support/hash_with_indifferent_access' -e "puts JSON::VERSION; puts JSON.dump HashWithIndifferentAccess.new" | |
1.7.5 | |
{} |
namespace :db do | |
desc 'Open a MongoDB console with connection parameters for the current Rails.env' | |
task :console, [:session] => :environment do |t, args| | |
session_name = args[:session] || :default | |
config = Mongoid.sessions[session_name] | |
username = config[:username] | |
password = config[:password] | |
database = config[:database] |
require 'benchmark' | |
Benchmark.bm {|x| x.report { 1_000.times { defined?(::UNF::Normalizer) } } } | |
user system total real | |
0.300000 0.010000 0.310000 ( 0.340000) |
RUBY_VERSION | |
# => "2.1.1" | |
require 'benchmark' | |
DEFAULT_OPTIONS = {validate: true} | |
def default_options | |
{validate: true} | |
end |
require 'time' | |
require 'benchmark' | |
time = Time.now.iso8601(3) | |
# => "2014-05-26T23:26:08.628-07:00" | |
Benchmark.bm do |x| | |
x.report('parse') { 100_000.times { Time.parse(time).gmtime } } | |
x.report('iso8601') { 100_000.times { Time.iso8601(time).gmtime } } | |
end |
# Tested with ActiveRecord 4.0.5 | |
# Run using: | |
# BUNDLE_GEMFILE=gemfiles/rails_4.0.gemfile bundle console | |
require 'sqlite3' | |
require 'active_record' | |
require 'groupify/adapter/active_record' | |
ActiveSupport::VERSION::STRING | |
# => "4.0.5" |
require 'appcanary' | |
Appcanary.configure do |config| | |
config.api_key = ENV['APPCANARY_API_KEY'] | |
end | |
# Explicitly specify language and file | |
Appcanary.check(language: :ruby, file: 'Gemfile.lock') | |
# Autodetect Ruby as the language and Gemfile.lock as the file |