Skip to content

Instantly share code, notes, and snippets.

View arthurnn's full-sized avatar
🟢
CI is passing

Arthur Nogueira Neves arthurnn

🟢
CI is passing
View GitHub Profile
require 'benchmark/ips'
require 'nokogiri'
xml = <<-DOC
<schema>
{
"name": "Ken block",
"settings": [
{
"type": "text",
[arthurnn@ralph lhm]$ BUNDLE_GEMFILE=gemfiles/ar-4.1_mysql2.gemfile bundle exec rake
/Users/arthurnn/.rbenv/versions/2.1.5/bin/ruby -I"lib:lib:spec" -I"/Users/arthurnn/dev/lhm/gemfiles/vendor/bundle/gems/rake-10.4.2/lib" "/Users/arthurnn/dev/lhm/gemfiles/vendor/bundle/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "spec/unit/active_record_connection_spec.rb" "spec/unit/atomic_switcher_spec.rb" "spec/unit/chunker_spec.rb" "spec/unit/connection_spec.rb" "spec/unit/entangler_spec.rb" "spec/unit/intersection_spec.rb" "spec/unit/lhm_spec.rb" "spec/unit/locked_switcher_spec.rb" "spec/unit/migration_spec.rb" "spec/unit/migrator_spec.rb" "spec/unit/printer_spec.rb" "spec/unit/sql_helper_spec.rb" "spec/unit/table_spec.rb" "spec/unit/throttler_spec.rb"
Run options: --seed 61099
# Running:
100% complete ...
100% complete
100% complete
100% complete
def foo
fail "omg!"
rescue ex
false
end
foo
@arthurnn
arthurnn / post-receive
Created February 8, 2015 00:20
post-receive for rails app
#!/bin/bash
git --work-tree=/var/www/site --git-dir=/home/repo/site.git checkout -f
echo "======= Using RVM environment"
source "/usr/local/rvm/scripts/rvm"
unset $(git rev-parse --local-env-vars)
cd /var/www/site
echo $(ruby -v)
gem "sass", "~> 3.2.6"
#gem "sass", "~> 3.3.9"
require 'sass'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
#ActiveRecord::Base.establish_connection(adapter: 'mysql2', database: 'test', username: 'root')
#ActiveRecord::Base.establish_connection(adapter: "postgresql", host: "localhost", user: "postgres", database: "test")
p ActiveRecord.version
ActiveRecord::Base.logger = Logger.new(STDOUT)
[arthurnn@ralph clearance]$ ./bin/setup
Resolving dependencies...
Using rake 10.4.2
Using minitest 5.5.0
Using thread_safe 0.3.4
Using i18n 0.7.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.1
Using json 1.8.1
[arthurnn@ralph rubygems.org]$ bundle exec rake
DEPRECATION WARNING: The following options in your Version.has_many :dependencies declaration are deprecated: :order,:include. Please use a scope block instead. For example, the following:
has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment'
should be rewritten as the following:
has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'
. (called from <class:Version> at /Users/arthurnn/dev/rubygems.org/app/models/version.rb:3)
rake aborted!
module Concerns
module PullReview
def award_pullreview_coupon
return unless coupon.present?
return coupon if pull_requests.year(CURRENT_YEAR).length > 23
end
private
def coupon
@arthurnn
arthurnn / 18070.diff
Created December 19, 2014 19:35
fix 18070
diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb
index 4358f3b..dcc47b7 100644
--- a/activerecord/lib/active_record/associations/preloader.rb
+++ b/activerecord/lib/active_record/associations/preloader.rb
@@ -92,7 +92,7 @@ module ActiveRecord
NULL_RELATION = Struct.new(:values, :bind_values).new({}, [])
def preload(records, associations, preload_scope = nil)
- records = Array.wrap(records).compact.uniq
+ records = Array.wrap(records).compact