Skip to content

Instantly share code, notes, and snippets.

@rzane
rzane / ar_fb_3.2.21.txt
Created November 26, 2014 02:53
activerecord-fb-adapter test failures with activerecord 3.2.21
This file has been truncated, but you can view the full file.
Finished tests in 327.471419s, 11.7232 tests/s, 31.3188 assertions/s.
1) Failure:
ActiveRecord::AdapterTest#test_disable_referential_integrity [/home/ray/Workspace/fb_adapter/rails/activerecord/test/cases/adapter_test.rb:147]:
Exception raised:
<#<ActiveRecord::InvalidForeignKey: Fb::Error: violation of FOREIGN KEY constraint ""
violation of FOREIGN KEY constraint "FK_NAME" on table "FK_TEST_HAS_FK"
Foreign key reference target does not exist
: INSERT INTO fk_test_has_fk (id, fk_id) VALUES (1001,0)>>.
@rzane
rzane / ar_fb_4.0.12.txt
Created November 26, 2014 02:54
activerecord-fb-adapter failures with activerecord 4.0.12
Finished tests in 519.667393s, 8.3534 tests/s, 21.4676 assertions/s.
1) Error:
ActiveRecord::AdapterTest#test_disable_referential_integrity:
ActiveRecord::InvalidForeignKey: Fb::Error: violation of FOREIGN KEY constraint ""
violation of FOREIGN KEY constraint "FK_NAME" on table "FK_TEST_HAS_FK"
Foreign key reference target does not exist
: INSERT INTO fk_test_has_fk (id, fk_id) VALUES (1001,0)
/home/ray/Workspace/fb_adapter/activerecord-fb-adapter-updated/lib/active_record/connection_adapters/fb/database_statements.rb:18:in `execute'
/home/ray/Workspace/fb_adapter/activerecord-fb-adapter-updated/lib/active_record/connection_adapters/fb/database_statements.rb:18:in `block (2 levels) in execute'
@rzane
rzane / ar_fb_4.1.8.txt
Created November 26, 2014 02:56
activerecord-fb-adapter failures with activerecord 4.1.8
Finished in 528.247378s, 8.6153 runs/s, 21.9916 assertions/s.
1) Failure:
ActiveRecord::Migration::ColumnsTest#test_change_column [/home/ray/Workspace/fb_adapter/rails/activerecord/test/cases/migration/columns_test.rb:202]:
Expected #<ActiveRecord::ConnectionAdapters::FbColumn:0x00000007f51d18 @firebird_type="INTEGER", @name="approved", @sql_type="INTEGER", @null=true, @limit=nil, @precision=nil, @scale=nil, @type=:integer, @default="1", @default_function=nil, @primary=nil, @coder=nil, @domain="BOOLEAN", @sub_type=0> to be nil or false
2) Error:
ActiveRecord::Migration::ColumnsTest#test_change_column_default:
ActiveRecord::StatementInvalid: Fb::Error: Invalid token
require 'bundler/inline'
require 'minitest/spec'
require 'minitest/autorun'
gemfile true do
source 'https://rubygems.org'
gem 'activerecord', '~> 5.0.0'
gem 'sqlite3'
gem 'baby_squeel', github: 'rzane/baby_squeel'
end
@rzane
rzane / squeel_test.rb
Last active July 22, 2016 03:31
Test Squeel's behavior when dealing with associated columns
require 'bundler/inline'
require 'minitest/spec'
require 'minitest/autorun'
gemfile true do
source 'https://rubygems.org'
gem 'activerecord', '4.2.6', require: false
gem 'sqlite3'
gem 'squeel', '1.2.3', require: false
end
@rzane
rzane / .babelrc
Last active November 22, 2016 17:06
Mobx Examples
{
"presets": [
"es2015"
],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
]
}
@rzane
rzane / pg_transfer.rb
Created April 3, 2017 21:27
Transfer everything from one postgres instance to another
#!/usr/bin/env ruby
require 'uri'
require 'delegate'
class PG < SimpleDelegator
FLAGS = ['--verbose', '--clean', '--no-owner', '--no-acl', '-j', '4']
def initialize(url)
super URI.parse(url)
@rzane
rzane / declare-props.js
Created November 15, 2017 21:13
An interactive script to declare react props
const fs = require('fs');
const path = require('path');
const { CLIEngine } = require('eslint');
const readline = require('readline-sync');
const cli = new CLIEngine({
parser: 'babel-eslint',
useEslintrc: false,
plugins: ['react'],
rules: { 'react/prop-types': ['error', {}] }
@rzane
rzane / fix_callbacks.rb
Created May 18, 2017 20:03
Fix deprecated ActiveModel::Dirty methods for Active Record 5.1
class After < Struct.new(:text)
def call
text.gsub(Model::FIXES[0], 'saved_change_to_\1?')
.gsub(Model::FIXES[1], '\1_before_last_save')
end
end
class Before < Struct.new(:text)
def call
text.gsub(Model::FIXES[0], 'will_save_change_to_\1?')
@rzane
rzane / index.html
Created March 2, 2018 18:56
Apollo Boost Headers Reproduction
<html>
<head>
<title>Apollo Query Reproduction</title>
<meta charset="UTF-8" />
</head>
<body>
<div id="app">
<h1>These are the headers that get sent along:</h1>
</div>