Skip to content

Instantly share code, notes, and snippets.

@rolandobrown
Created October 8, 2015 07:43
Show Gist options
  • Save rolandobrown/c02ec0741427cc6d1bbc to your computer and use it in GitHub Desktop.
Save rolandobrown/c02ec0741427cc6d1bbc to your computer and use it in GitHub Desktop.
Sample of Data Class from Ruby AI
# "String"
#----------#
# A string is any finite sequence of characters (i.e., letters, numerals, symbols and punctuation marks).
# Strings are wrapped in quotes: "String"
# Strings can be stores in variables. Below are a few @@globalvariables
# MINASWAN is a Ruby programming motto designed to promote positivity and goodwill among community members.
@@minaswan = 'Matz is Nice And So We Are Nice.'
# [Arrays]
#----------#
# Arrays are ordered, integer-indexed collections of any object.
# Below are two arrays: one that shared
# Note the @ just allows me to access the values of ada_imagination_is from another class named Data.
@@ada_array_imagination_is = ["The Discovering Faculty, which penetrates into the unseen worlds around us: as in the worlds of Science.", "The Combining Faculty, which seizes points in common, between subjects having no apparent connection."]
@@avi_array_programming_is = ["The Science of Operation.", "The Art of Composition."]
# {Hashes}
#----------#
# A Hash is a collection of key-value pairs.
# You retrieve or create a new entry in a Hash by referring to its key.
# Below is are three hashes.
# One that includes three hashes of golden rules from instructors here at Flatiron School.
# A second that includes four quotes from science fiction programmer Octavia Bulter.
# A third that includes five quotes from Hiphop duo Dead Prez.
@@learn_love_code_golden_hash = {
:of_learning_programming =>
{ :one => "Learn Syntax and Semantics: Syntax is the grammar, structure, or order of elements in a language statement. Semantics is the meaning of these elements.",
:two => "Learn Programmatic Thinking: That means you make it work, then make it right, then make it fast. Programmatic thinking is all about problem solving.",
:three => "Learn Design Patterns: Other programmers have likely experienced the problem you are looking to solve. ActiveRecord is just one of them! There are many."},
:of_composing_programs =>
{ :one => "A languages keywords, like 'if' or 'end'. In Ruby there are approximately 43 keywords.",
:two => "Literal data, things like 'Strings' and Numbers 1,2,3, etc.",
:three => "Finally, Barewords you define and create, things like variables and methods."},
:of_self =>
{ :one => "Use self when setting/getting instance attributes inside a class definition.",
:two => "Use self to denote a method within the class definition as a class method.",
:three => "Use self to reference the calling object within an instance method definition."}
}
@@octavia_butler_golden_hash = {
:of_talent =>
{ :one => "I am me, and I am here, and I am writing.",
:two => "Habit is persistence in practice.",
:three => "Kindness eases change.",
:four => "You dont start out writing good stuff. You start out writing crap and thinking its good stuff, and then gradually you get better at it. \n \nThat is why I say one of the most valuable traits is persistence."}
}
@@dead_prez_golden_hash = {
:of_discipline =>
{ :one => "Practice makes perfect.",
:two => "Health is Wealth.",
:three => "All things in moderation.",
:four => "Plan your work.",
:five => "Work your plan."}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment