Skip to content

Instantly share code, notes, and snippets.

View subvertallchris's full-sized avatar
💭
🤘 brutal

Chris Grigg subvertallchris

💭
🤘 brutal
  • Long Island City, NY
View GitHub Profile
@subvertallchris
subvertallchris / dumb_has_many_example.rb
Last active August 29, 2015 14:04
really simple example of has_many behavior
#copy and paste into rails console to play
module DumbHasMany
extend ActiveSupport::Concern
module ClassMethods
def has_many(method, args=nil)
if args.nil? || !args.is_a?(Hash)
type = method
else
jruby-1.7.4 :769 > Neo4j._query("start n=node(*) match (n) where n.username! =~ '(?i)chrISTOpher' return n").first[:n].username
=> "christopher"
u = Neo4j._query("start n=node(*) match (n) where n.subject! =~ '[a-z\s]+?at[a-z\s]+?' or n.username! =~ '[a-z]+?man[a-z]+?' return n").to_a