Skip to content

Instantly share code, notes, and snippets.

EXCLUDE="--exclude-dir=docs --exclude-dir=test --exclude-dir=spec"
for CONST in `grep --include=*.rb $EXCLUDE --no-filename --only-matching --perl --recursive '[A-Z][A-Za-z0-9]+(::[A-Z][A-Za-z0-9]+)+' . | grep -v 'Controller$' | grep -v '^AASM\|AbstractController\|Action\|Active\|Algolia\|Aws\|BigDecimal\|ConnectionPool\|CoreExt\|Devise\|Digest\|Dir\|Dry\|Faker\|Hashie\|OpenSSL\|Postmark\|Rails\|Rake\|Resque\|Rollbar\|Sinatra\|Slim\|URI\|Unicorn\|Zlib\|GraphQL' | sort -u`
do
COUNT=`grep --include=*.rb $EXCLUDE --no-filename --recursive $CONST . | grep -v '^ *#' | wc -l`
if [[ $COUNT -eq 1 ]]
then
echo "########### $CONST ($COUNT)"
echo "grep --include=*.rb -r $CONST . "
grep --include=*.rb $EXCLUDE --recursive --color $CONST .
echo
@danlo
danlo / derpy.rb
Created August 6, 2018 17:31
brain twister
class BaseDoc
include Mongoid::Document
has_one :child, class_name: 'ChildDoc', inverse_of: :parent
field :data, type: String
end
class ChildDoc
include Mongoid::Document

Keybase proof

I hereby claim:

  • I am danlo on github.
  • I am daniello (https://keybase.io/daniello) on keybase.
  • I have a public key ASBX7WAZGbG1o-ibCuM8VXCmS5AXF-5ny7ndnMhoXjn4aAo

To claim this, I am signing this object: