I hereby claim:
- I am replaid on github.
- I am rep (https://keybase.io/rep) on keybase.
- I have a public key ASCQqLi-yHok4PIouZjkILaJ5jUFRMrj__Ebwe-uaqpKJwo
To claim this, I am signing this object:
sh my-fancy-script.sh input.txt > log-file |
... | |
def check_for_pollution | |
tables_with_records = [] | |
all_tables = ActiveRecord::Base.connection.tables | |
all_tables.each do |table_name| | |
has_records = (ActiveRecord::Base.connection.select_value("select exists (select 1 from #{table_name} limit 1)") > 0) | |
tables_with_records << table_name if has_records | |
end | |
expected_tables_with_records = ['schema_migrations'] |
# Adapted for Rails 4 from http://trevorturk.com/2008/09/20/validating-your-fixtures/ | |
# I put this in test/models/. Trevor put his in test/integration/. | |
require 'test_helper' | |
class FixtureValidationTest < ActiveSupport::TestCase | |
test "fixtures should be valid" do | |
models = ActiveRecord::FixtureSet.all_loaded_fixtures.keys | |
models.each do |model| |
ActiveRecord::Base.connection.tables.each do |table_name| | |
ActiveRecord::Base.connection.execute("select * from #{table_name} into outfile '/tmp/datadump-#{table_name}.outfile'") | |
end |
components/ | |
my_bounded_context/ | |
app/ | |
presentation/ # This is called the "UI" layer in DDD literature, but it is also | |
# where things like JSON interfaces live -- any kind of presentation | |
# or handshake to anything outside. So "presentation" rather than "ui". | |
assets/ | |
helpers/ | |
mailers/ | |
views/ |
require 'domain' | |
require 'persist/rom' | |
require 'persist/users_relation' | |
rom = ROM.env | |
p rom | |
Domain::Repository::User.delegate = rom.relation(:users).as(:user) |
I hereby claim:
To claim this, I am signing this object:
We want to demonstrate how easy it is to model a domain as a graph and answer questions in almost natural language.
Graph Based Search and Discovery is prominent a use-case for graph databases like Neo4j.
class FlattenEnum | |
class << self | |
# Returns an enumerator that yields the non-enumerable items from within a | |
# nested enumerable, in depth-first order. | |
# | |
# Example: | |
# | |
# FlattenEnum.create([[1, 2, [3]], 4]).to_a | |
# #=> [1, 2, 3, 4] |
irb(main):001:0> module Mixin; end | |
=> nil | |
irb(main):002:0> class A | |
irb(main):003:1> include Mixin | |
irb(main):004:1> end | |
=> A | |
irb(main):005:0> a = A.new | |
=> #<A:0x007fbaea8a89a8> | |
irb(main):006:0> a.is_a? Mixin | |
=> true |