This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo lets practice has-and-belongs-to-many-relationships in rails | |
echo lets create a record of which players know how to play which games | |
rails new gamelog | |
cd gamelog/ | |
rake db:create | |
rails generate model Player name:string | |
rails generate model Game name:string | |
echo add has_and_belongs_to_many calls to both models | |
echo see http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association for details | |
echo this next command isnt what I want because it doesnt create .players and .games methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Class Hierarchy | |
A | |
/ \ | |
B1 B2 | |
/ \ | |
C1 C2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
public | |
def do_thing(x) | |
super_secret_internal_implementation_function_xpjdljadhlhjjalj(x) * 10 | |
end | |
private | |
# randomly chosen name no one else is likely to use: | |
def super_secret_internal_implementation_function_xpjdljadhlhjjalj(x) | |
x*x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I feel very uncertain this is the Right Thing. | |
-- tested against Elm 0.19 | |
import Json.Decode exposing (..) | |
type TreeOfInt | |
= Branch (List TreeOfInt) | |
| Leaf Int | |
-- decodeString treeOfInt "[7, [10]]" => Branch [Leaf 7, Branch [Leaf 10]] | |
treeOfInt : Decoder TreeOfInt |