Skip to content

Instantly share code, notes, and snippets.

View Haumer's full-sized avatar
🎯
Focusing

Alex Haumer Haumer

🎯
Focusing
  • London
View GitHub Profile
# string
"Hello world"
# integer
423
# float
3.14
# array
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
# 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
first personal file
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']}"
require_relative 'scraper'
puts "Fetching URLs"
urls = fetch_movie_urls
movies = urls.map do |url|
puts "Scraping #{url}"
scrape_movie(url)
end
require_relative 'scraper'
puts "Fetching URLs"
urls = get_urls
movies = urls.map do |url|
puts "Scraping #{url}"
scrape_movie(url)
end
@Haumer
Haumer / E001_instagram_public.rb
Created July 17, 2020 14:52
InstagramClient for the latest 12 posts
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
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
# Customer list
SELECT first_name, last_name, email FROM customers
ORDER BY last_name
# Classical Playlist
SELECT tracks.name, tracks.composer FROM playlist_tracks