This file contains hidden or 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
| # string | |
| "Hello world" | |
| # integer | |
| 423 | |
| # float | |
| 3.14 | |
| # array |
This file contains hidden or 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
| Computer science is the study of the theory, experimentation, and engineering that form the basis for the design and use of computers. It is the scientific and practical approach to computation and its applications and the systematic study of the feasibility, structure, expression, and mechanization of the methodical procedures (or algorithms) that underlie the acquisition, representation, processing, storage, communication of, and access to, information. An alternate, more succinct definition of computer science is the study of automating algorithmic processes that scale. A computer scientist specializes in the theory of computation and the design of computational systems.[1] | |
| Its fields can be divided into a variety of theoretical and practical disciplines. Some fields, such as computational complexity theory (which explores the fundamental properties of computational and intractable problems), are highly abstract, while fields such as computer graphics emphasize real-world visual applications. Other fields |
This file contains hidden or 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
| # Q6 - Complete the following code to compute the exact average of students | |
| # grades (using each ). | |
| grades = [19, 8, 11, 15, 13] | |
| sum = 0 | |
| # 1) with .each | |
| grades.each { |grade| sum += grade } | |
| p sum.to_f / grades.size |
This file contains hidden or 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
| first personal file |
This file contains hidden or 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
| require 'json' | |
| require 'open-uri' | |
| # Lets call the github API | |
| url = 'https://api.github.com/users/haumer/gists' | |
| user_serialized = open(url).read | |
| user = JSON.parse(user_serialized) | |
| puts "#{user['name']} - #{user['bio']}" |
This file contains hidden or 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
| require_relative 'scraper' | |
| puts "Fetching URLs" | |
| urls = fetch_movie_urls | |
| movies = urls.map do |url| | |
| puts "Scraping #{url}" | |
| scrape_movie(url) | |
| end |
This file contains hidden or 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
| require_relative 'scraper' | |
| puts "Fetching URLs" | |
| urls = get_urls | |
| movies = urls.map do |url| | |
| puts "Scraping #{url}" | |
| scrape_movie(url) | |
| end |
This file contains hidden or 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
| require 'json' | |
| require 'http' | |
| class InstagramClient | |
| attr_reader :posts, :followers | |
| def initialize(instagram_handle) | |
| @instagram_handle = instagram_handle | |
| @url = "https://www.instagram.com/#{@instagram_handle}/?__a=1".freeze | |
| @data = JSON.parse HTTP.get(@url).to_s |
This file contains hidden or 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
| require "open-uri" | |
| require "json" | |
| class TflApi | |
| def initialize | |
| @url = "https://api.tfl.gov.uk/line/mode/tube,overground,dlr,tflrail/status".freeze | |
| retrieve_data | |
| end | |
| def retrieve_data |
This file contains hidden or 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
| # Customer list | |
| SELECT first_name, last_name, email FROM customers | |
| ORDER BY last_name | |
| # Classical Playlist | |
| SELECT tracks.name, tracks.composer FROM playlist_tracks |