- Generate a new Rails app
rails new [APP-NAME] -T -d postgresql --skip-turbolinks
- Make an initial commit
cd [APP-NAME]
| numbers = [1,2,3] | |
| numbers.each do |num| | |
| puts "I am #{num}" | |
| end | |
| double_numbers = numbers.map do |num| | |
| num * 2 | |
| end |
| var numbers = [1, 2, 3]; | |
| numbers.forEach(function(num, index, array) { | |
| console.log('I am ' + num) | |
| }) | |
| var doubledNumbers = numbers.map(function(num) { | |
| return num * 2 | |
| }); |
| require 'pry' | |
| class GumballMachineTerminalView | |
| def initialize | |
| end | |
| def welcome_message | |
| puts "Welcome to the Squirrel's Gumball Machine" | |
| end |
| require 'open-uri' | |
| require 'json' | |
| require 'pry' | |
| # THE ADDRESS ON THE INTERNET YOU WANT TO FETCH DATA FROM | |
| BASE_URL = "https://data.cityofnewyork.us/resource/uvbq-3m68.json" | |
| # GET USER INPUT TO MAKE IT DYNAMIC | |
| puts 'What is the license plate number you want to search for?' | |
| user_input = gets.chomp |
| class Timeline << React::Component { | |
| def initialize(props) { | |
| super(props) | |
| @state = { tweets: [] } | |
| } | |
| def component_did_mount() { | |
| self.fetchTweets(); | |
| } |
| class Timeline extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| tweets: [] | |
| }; | |
| this.fetchTweets = this.fetchTweets.bind(this); | |
| } | |
| componentDidMount() { |
| const Timeline = React.createClass({ | |
| getInitialState: function() { | |
| return { tweets: [] }; | |
| }, | |
| componentDidMount: function() { | |
| this.fetchTweets(); | |
| }, | |
| fetchTweets: function() { |
| #Creating an app called my_great_app | |
| rails new my_great_app -T -d postgresql --skip-turbolinks | |
| cd my_great_app | |
| git init | |
| git add . | |
| git commit -m "Initial commit. Rails boilerplate." | |
| # Edit gemfile | |
| # #Remove the reference to coffee-rails. |
| class Gumball | |
| attr_reader :color, :flavor | |
| DEFAULT_COLORS = ['red', 'green', 'blue'] | |
| DEFAULT_FLAVORS = ['sour apple', 'bacon', 'gravy'] | |
| def initialize(options={}) | |
| @color = options.fetch(:color) { DEFAULT_COLORS.sample } | |
| @flavor = options.fetch(:flavor) { DEFAULT_FLAVORS.sample } | |
| end | |
| end |