Skip to content

Instantly share code, notes, and snippets.

View Haumer's full-sized avatar
🎯
Focusing

Alex Haumer Haumer

🎯
Focusing
  • London
View GitHub Profile
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']}"
first personal file
# 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
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
# string
"Hello world"
# integer
423
# float
3.14
# array
# string
"Hello world"
# integer
423
# float
3.14
# array
@Haumer
Haumer / B423_each_and_map.rb
Last active July 9, 2020 23:15
Short showcase of .each, .map and .map! and what they return
# .EACH, .MAP and .MAP!
numbers = [1, 2, 3, 4, 5] # this is our starting/original array
# EACH
numbers.each do |number|
number * 2 # simply multiplying each value by 2
end
#=> [1, 2, 3, 4, 5]
p numbers
stuff
"hello here"