Skip to content

Instantly share code, notes, and snippets.

@chron
Created May 4, 2019 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chron/38cd56b83890b00ad427e0e634a78f4b to your computer and use it in GitHub Desktop.
Save chron/38cd56b83890b00ad427e0e634a78f4b to your computer and use it in GitHub Desktop.
Development Faculty Vision Generator 1.0
class Grammar
class << self
attr_reader :rules
def method_missing(method, *args, &block)
@rules ||= Hash.new { |h,k| h[k] = [] }
@rules[method] += [*args, block].flatten.compact
end
end
def method_missing(method, *args)
if self.class.rules.key?(method)
possible_rules = self.class.rules[method]
rule = possible_rules.sample
possible_rules.delete(rule)
raise "#{method} ran out of template strings" if rule.nil?
rule.is_a?(Proc) ? instance_eval(&rule) : rule
else
super
end
end
end
class DevelopmentVision < Grammar
root { "A #{team_qualities} #{group} of #{individual_qualities} #{people} #{mission}." }
team_qualities { "#{team_adjective}" }
team_qualities { "#{team_adjective} and #{team_adjective}" }
team_qualities { "#{team_adjective}, #{team_adjective} and #{team_adjective}" }
team_adjective 'diverse', 'distributed', 'supportive', 'fault-tolerant'
group 'group', 'team', 'network', 'family'
individual_qualities { "#{individual_adjective}" }
individual_qualities { "#{individual_adjective} and #{individual_adjective}" }
individual_qualities { "#{individual_adjective}, #{individual_adjective} and #{individual_adjective}" }
individual_adjective 'curious', 'technically-minded', 'clever', 'brilliant', 'innovative'
people 'individuals', 'people', 'hackers', 'developers', 'humans'
mission { "#{verbing} the #{technology} #{powering} #{product}" }
verbing 'driving', 'delivering', 'producing', 'owning', 'creating', 'stewarding', 'supporting', 'coding'
technology 'technology', 'tech', 'platform', 'stack', 'engine', 'brains'
powering 'behind', 'powering', 'responsible for', 'bringing you', 'that gives you', 'that brings you', 'that delivers'
product { "#{place}'s favourite #{ux} brand" }
product { "next-level #{ux}" }
product { "#{ux} of the future" }
product 'Optimal Workshop'
product { "cutting-edge #{ux}" }
product 'a wealthier Andrew Mayfield', "Gregory's cocaine addiction"
place 'New Zealand', 'the world'
ux 'UX', 'user experience', 'user research'
end
if __FILE__ == $0
vision = DevelopmentVision.new
puts vision.root
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment