Skip to content

Instantly share code, notes, and snippets.

View rpearce's full-sized avatar
👶
infant and toddler duty

Robert Pearce rpearce

👶
infant and toddler duty
View GitHub Profile
@rpearce
rpearce / your-first-rb-program.md
Last active May 10, 2022 02:24
Your First Ruby Program

Your First Ruby Program

Welcome to Ruby! In this lesson, we will learn about what Ruby is and write our very first program.

What Is It, and Why Does It Exist?

Ruby is a versatile, beginner-friendly programming language that exists to

Help every programmer in the world to be productive, to enjoy programming, and to be happy.[1] — Yukihiro Matsumoto ("Matz"), creator of Ruby

Different programing languages have varying levels of complexity that are placed on the developer in order to perform tasks. Where Ruby stands out is that, given it is focused on developer happiness, it will always try to make the developer's life easier.

@rpearce
rpearce / bank_users.csv
Created September 28, 2015 16:02
Bank Users CSV
name pin balance
Elmo 5746 99999999
Oscar 4444 20
Mario 9090 10000
Peach 0000 100000000
Luigi 1234 474748
@rpearce
rpearce / interpol_hash_challenge.rb
Last active September 13, 2015 16:32
Interpolation & Hash Accessing Challenge
# Your task is to use the `people` array of hashes below
# to create interpolated strings that will `puts` to the
# console the following lines:
#
# James, aged 82, is from Charleston, SC
# Jane, aged 67, is from New York, NY
# Jude, aged 42, is from London, UK
people = [
{ name: 'James', age: '82', location: 'Charleston, SC' },
@rpearce
rpearce / range_modulo_challenge.rb
Created August 27, 2015 19:39
Range Modulo Challenge
# Use Enumerable to select all of the multiples
# of 3 in any given Range and return them in an Array.
# Hint: Check out the modulo operator.
#
# The output should read like the following:
# => [3, 6, 9, 12, 15, 18, 21, 24, 27, 30]
#
# The resources you can use:
# http://ruby-doc.org/core-2.2.3/Enumerable.html
# http://stackoverflow.com/a/3517240
@rpearce
rpearce / song_class_challenge.rb
Last active August 27, 2015 16:00
Song Class Challenge
class Song
# your code here
end
song = Song.new(
id: 1,
title: "Mother",
author: "Pink Floyd",
album: "The Wall"
)
@rpearce
rpearce / songs_iteration_to_csv_challenge.rb
Last active August 27, 2015 02:36
Songs Iteration and CSV Writing Challenge
songs = [
{
id: 1,
title: "Mother",
author: "Pink Floyd",
album: "The Wall"
},
{
id: 2,
title: "Since I've been Loving You",
@rpearce
rpearce / songs_map_challenge.rb
Last active August 27, 2015 02:36
Songs Map Challenge
songs = [
{
id: 1,
title: "Mother",
author: "Pink Floyd",
album: "The Wall"
},
{
id: 2,
title: "Since I've been Loving You",
@rpearce
rpearce / teaching_switches.js
Created August 25, 2015 11:39
Teaching Switches
var str = "great minds think alike";
var output = [];
str.split('').forEach(function(letter) {
switch (letter) {
// your code here
}
});
output.join(''); // should be "grtmndsthnklk"
@rpearce
rpearce / teaching_functions.js
Last active August 29, 2015 14:28
Teaching Functions
function greet(name, day, special) {
// your code here
}
greet('Robert', 'Tuesday', 'fried catfish'); // This should return the String "Hello, Robert. Today is Tuesday, and the special is fried catfish."
// ==========================================================
function sumOf(numbers) {
// your code here
}
func greet(name: String, day: String, special: String) -> String {
return "Hello \(name), today is \(day), and the special is \(special)."
}
greet("Bob", day: "Tuesday", special: "Catfish")