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
//&& will only do the rhs if lhs is truthy | |
this.props.botPresent && this.state.bots.map(...) | |
let { bot } = props; | |
// is equivalent to.. | |
let bot = props.bot; |
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
rails destroy resource Dog #get rid of everything related to Dog | |
-------------------------------------------------------------------------- | |
rails new dog-app -T #-T to create without the test framework . Test with byebug | |
cd dog-app/ | |
# To create a rails api app with postgresql as the database: | |
rails new <my_app_name> --database=postgresql --api | |
# Navigate to your Gemfile and uncomment gem 'rack-cors' | |
# Make sure you add the gem 'active_model_serializers' to your Gemfile. |
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 VideoGameCharacter | |
@@all = [] | |
def initialize(name, level) | |
@name = name | |
@level = level | |
@@all << self | |
end |
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 VideoGameCharacter | |
def initialize(name, level) | |
@name = name | |
@level = level | |
end | |
end |
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 Wizard | |
attr_accessor :name, :age, :hair_colour, :favourite_spell | |
@@all = [] | |
def initialize(name, age, hair_colour, favourite_spell) | |
@name = name | |
@age = age | |
@hair_colour = hair_colour |
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
wizards = { | |
"Harry" =>{ | |
:full_name => "Harry James Potter", | |
:age => 12, | |
:hair_colour => "brown", | |
:favourite_class => "Defence Against the Dark Arts" | |
}, | |
"Ron" =>{ | |
:full_name => "Ronald Bilius Weasley", | |
:age => 11, |
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
wizard = ["Harry Potter", 12, "brown"] | |
wizards = [["Harry Potter", 12, "brown"],["Ron Weasley", 11, "ginger"],["Hermione Granger", 12, "brown"]] |
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
wizard = "Harry Potter" | |
wizard #=> "Harry Potter" |