hackety_hack-lessons 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/content/{tour.md → a-tour-of-hackety-hack.md} +9 -40
- data/content/{programming.md → an-introduction-to-programming.md} +5 -30
- data/content/{ruby.md → an-introduction-to-ruby-with-hackety-hack.md} +6 -31
- data/content/{shoes.md → an-introduction-to-shoes.md} +8 -32
- data/lib/hackety_hack/lessons.rb +4 -0
- data/lib/hackety_hack/lessons/version.rb +1 -1
- metadata +7 -9
- data/content/data_types.md +0 -125
- data/content/datastrucs.md +0 -146
@@ -1,50 +1,19 @@
|
|
1
1
|
---
|
2
|
-
title: "Tour"
|
2
|
+
title: "A Tour of Hackety Hack"
|
3
|
+
slug: "a-tour-of-hackety-hack"
|
4
|
+
categories:
|
5
|
+
- hackety
|
6
|
+
- beginner
|
3
7
|
---
|
4
8
|
|
5
|
-
# A Tour of Hackety Hack
|
6
|
-
|
7
9
|
## Welcome!
|
8
10
|
|
9
11
|
### Why hello there!
|
10
12
|
|
11
13
|
Welcome to the Hackety Hack tour!
|
12
14
|
|
13
|
-
This whole side of the screen is the _Hackety Hack Tutor_. You can move forward
|
14
|
-
through the lessons by clicking the _Next_ button:
|
15
|
-
|
16
|
-

|
17
|
-
|
18
|
-
Give it a shot!
|
19
|
-
|
20
|
-
### Good Job!
|
21
|
-
|
22
|
-
See? Super easy. Let's explore the rest of Hackety Hack.
|
23
|
-
|
24
15
|
You can access the different functions of Hackety through the buttons on the
|
25
|
-
left side of the screen.
|
26
|
-
There are 8 of those buttons, but since you're already on Lessons, let's talk
|
27
|
-
about them first.
|
28
|
-
|
29
|
-
Before we move on, just take a minute to look at the controls in the bar below.
|
30
|
-
|
31
|
-

|
32
|
-
__back__: goes back one page
|
33
|
-
|
34
|
-

|
35
|
-
__continue__: goes to the next page
|
36
|
-
|
37
|
-

|
38
|
-
__menu__: makes it easy to jump around to any lesson
|
39
|
-
|
40
|
-

|
41
|
-
__close__: closes the tutor
|
42
|
-
|
43
|
-
Don't forget! Press this to move to the next part:
|
44
|
-
|
45
|
-

|
46
|
-
|
47
|
-
Have at it!
|
16
|
+
left side of the screen.
|
48
17
|
|
49
18
|
## Lessons
|
50
19
|
|
@@ -186,8 +155,8 @@ Come back soon!
|
|
186
155
|
This concludes the Hackety Hack tour. Good job! Now you know everything that
|
187
156
|
Hackety Hack can do. It's pretty simple!
|
188
157
|
|
189
|
-
This isn't the only lesson that we have for you, though. Give the '
|
190
|
-
Programming' lesson a shot to actually start learning how to
|
191
|
-
your own.
|
158
|
+
This isn't the only lesson that we have for you, though. Give the 'An
|
159
|
+
Introduction to Programming' lesson a shot to actually start learning how to
|
160
|
+
make programs of your own.
|
192
161
|
|
193
162
|
What are you waiting for? Get going!
|
@@ -1,9 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: "Programming"
|
2
|
+
title: "An Introduction to Programming"
|
3
|
+
slug: "an-introduction-to-programming"
|
4
|
+
categories:
|
5
|
+
- hackety
|
6
|
+
- beginner
|
3
7
|
---
|
4
8
|
|
5
|
-
# Beginner Programming
|
6
|
-
|
7
9
|
## Hello there!
|
8
10
|
|
9
11
|
### Round One
|
@@ -17,33 +19,6 @@ we'll start off by talking a little bit about what programming is, and then
|
|
17
19
|
we'll write some basic programs to draw fun things on the screen. Sound good?
|
18
20
|
Off we go!
|
19
21
|
|
20
|
-
Click the icon like this (on the bottom of the screen) to get started:
|
21
|
-
|
22
|
-

|
23
|
-
|
24
|
-
### Lesson Controls
|
25
|
-
|
26
|
-
Before we move on, Here's a refresher on the controls you can use to move around
|
27
|
-
in the Lesson.
|
28
|
-
|
29
|
-

|
30
|
-
__back__: goes back one page
|
31
|
-
|
32
|
-

|
33
|
-
__continue__: goes to the next page
|
34
|
-
|
35
|
-

|
36
|
-
__menu__: makes it easy to jump around to any lesson
|
37
|
-
|
38
|
-

|
39
|
-
__close__: closes the tutor
|
40
|
-
|
41
|
-
Don't forget! Press this to move to the next part:
|
42
|
-
|
43
|
-

|
44
|
-
|
45
|
-
Have at it!
|
46
|
-
|
47
22
|
## Let's talk about programming
|
48
23
|
|
49
24
|
### It's all about instructions
|
@@ -1,9 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: "Ruby"
|
2
|
+
title: "An Introduction to Ruby (with Hackety Hack)"
|
3
|
+
slug: "an-introduction-to-ruby-with-hackety-hack"
|
4
|
+
categories:
|
5
|
+
- hackety
|
6
|
+
- beginner
|
3
7
|
---
|
4
8
|
|
5
|
-
# Beginner Ruby
|
6
|
-
|
7
9
|
## Hello there!
|
8
10
|
|
9
11
|
### Let's get started
|
@@ -13,33 +15,6 @@ Welcome to your first lesson in Ruby! You're going to have a blast.
|
|
13
15
|
Ruby is a great programming language that you can use to make all kinds of
|
14
16
|
things with. Let's get going!
|
15
17
|
|
16
|
-
Click the icon like this (on the bottom of the screen) to get started:
|
17
|
-
|
18
|
-

|
19
|
-
|
20
|
-
### Lesson Controls
|
21
|
-
|
22
|
-
Before we move on, Here's a refresher on the controls you can use to move around
|
23
|
-
in the Lesson.
|
24
|
-
|
25
|
-

|
26
|
-
__back__: goes back one page
|
27
|
-
|
28
|
-

|
29
|
-
__continue__: goes to the next page
|
30
|
-
|
31
|
-

|
32
|
-
__menu__: makes it easy to jump around to any lesson
|
33
|
-
|
34
|
-

|
35
|
-
__close__: closes the tutor
|
36
|
-
|
37
|
-
Don't forget! Press this to move to the next part:
|
38
|
-
|
39
|
-

|
40
|
-
|
41
|
-
Have at it!
|
42
|
-
|
43
18
|
## A bit more about Ruby
|
44
19
|
|
45
20
|
### Konnichiwa, Ruby!
|
@@ -333,4 +308,4 @@ Here's what you've learned so far:
|
|
333
308
|
|
334
309
|
`if` and `else`
|
335
310
|
|
336
|
-
Awesome! You'll want to check out Basic Shoes next!
|
311
|
+
Awesome! You'll probably want to check out Basic Shoes next!
|
@@ -1,9 +1,11 @@
|
|
1
1
|
---
|
2
|
-
title: "Shoes"
|
2
|
+
title: "An Introduction to Shoes"
|
3
|
+
slug: "an-introduction-to-shoes"
|
4
|
+
categories:
|
5
|
+
- shoes
|
6
|
+
- beginner
|
3
7
|
---
|
4
8
|
|
5
|
-
# Beginner Shoes
|
6
|
-
|
7
9
|
## Hello there!
|
8
10
|
|
9
11
|
### Let's get started
|
@@ -14,33 +16,6 @@ basics that Shoes brings to everyone who programs.
|
|
14
16
|
If you didn't know, Shoes is a Ruby toolkit that lets you build GUI programs
|
15
17
|
really easy and fun!
|
16
18
|
|
17
|
-
Click the icon like this (on the bottom of the screen) to get started:
|
18
|
-
|
19
|
-

|
20
|
-
|
21
|
-
### Lesson Controls
|
22
|
-
|
23
|
-
Before we move on, Here's a refresher on the controls you can use to move around
|
24
|
-
in the Lesson.
|
25
|
-
|
26
|
-

|
27
|
-
__back__: goes back one page
|
28
|
-
|
29
|
-

|
30
|
-
__continue__: goes to the next page
|
31
|
-
|
32
|
-

|
33
|
-
__menu__: makes it easy to jump around to any lesson
|
34
|
-
|
35
|
-

|
36
|
-
__close__: closes the tutor
|
37
|
-
|
38
|
-
Don't forget! Press this to move to the next part:
|
39
|
-
|
40
|
-

|
41
|
-
|
42
|
-
Have at it!
|
43
|
-
|
44
19
|
## Apps
|
45
20
|
|
46
21
|
### Shoes.app
|
@@ -170,9 +145,10 @@ the file on your computer:
|
|
170
145
|
image "#{HH::STATIC}/matz.jpg"
|
171
146
|
end
|
172
147
|
|
173
|
-
(
|
148
|
+
(This particular example only works if you're in Hackety Hack, by the way!
|
149
|
+
Can you figure out what this does? Don't feel bad if you can't.)
|
174
150
|
|
175
|
-
|
151
|
+
Or you can also specify an image on the web:
|
176
152
|
|
177
153
|
Shoes.app do
|
178
154
|
image "http://shoesrb.com/images/shoes-icon.png"
|
data/lib/hackety_hack/lessons.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hackety_hack-lessons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: metadown
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152981180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152981180
|
25
25
|
description: A set of lessons to learn Ruby programming, from the Hackety Hack project.
|
26
26
|
email:
|
27
27
|
- steve@steveklabnik.com
|
@@ -34,12 +34,10 @@ files:
|
|
34
34
|
- LICENSE
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
|
-
- content/
|
38
|
-
- content/
|
39
|
-
- content/
|
40
|
-
- content/
|
41
|
-
- content/shoes.md
|
42
|
-
- content/tour.md
|
37
|
+
- content/a-tour-of-hackety-hack.md
|
38
|
+
- content/an-introduction-to-programming.md
|
39
|
+
- content/an-introduction-to-ruby-with-hackety-hack.md
|
40
|
+
- content/an-introduction-to-shoes.md
|
43
41
|
- hackety_hack-lessons.gemspec
|
44
42
|
- lib/hackety_hack/lessons.rb
|
45
43
|
- lib/hackety_hack/lessons/version.rb
|
data/content/data_types.md
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "Data Types"
|
3
|
-
---
|
4
|
-
# Data Types
|
5
|
-
|
6
|
-
## This is where it starts getting fun!
|
7
|
-
|
8
|
-
### Let's get started
|
9
|
-
|
10
|
-
Awesome! Glad to see you here! You're going to learn some great things in this
|
11
|
-
lesson. Ruby has a few different ways to manipulate data, and you're going to
|
12
|
-
play with them!
|
13
|
-
|
14
|
-
Click the icon like this (on the bottom of the screen) to get started:
|
15
|
-
|
16
|
-

|
17
|
-
|
18
|
-
### Lesson Controls
|
19
|
-
|
20
|
-
Before we move on, Here's a refresher on the controls you can use to move around
|
21
|
-
in the Lesson.
|
22
|
-
|
23
|
-

|
24
|
-
__back__: goes back one page
|
25
|
-
|
26
|
-

|
27
|
-
__continue__: goes to the next page
|
28
|
-
|
29
|
-

|
30
|
-
__menu__: makes it easy to jump around to any lesson
|
31
|
-
|
32
|
-

|
33
|
-
__close__: closes the tutor
|
34
|
-
|
35
|
-
Don't forget! Press this to move to the next part:
|
36
|
-
|
37
|
-

|
38
|
-
|
39
|
-
Have at it!
|
40
|
-
|
41
|
-
## Strings
|
42
|
-
|
43
|
-
### You've got this down!
|
44
|
-
|
45
|
-
_String_s are something you already know about! Let's refresh your memory.
|
46
|
-
|
47
|
-
Basically, Strings let you manipulate a bunch of characters. It's sort of like
|
48
|
-
writing something down: and often, Strings are used for handling input and
|
49
|
-
output. Check it out:
|
50
|
-
|
51
|
-
name = "Steve"
|
52
|
-
alert name
|
53
|
-
|
54
|
-
This should be familliar. If it isn't you may want to go review the Basic Ruby
|
55
|
-
lesson before moving on. Gotta learn the basics before you can understand the
|
56
|
-
hard stuff!
|
57
|
-
|
58
|
-
### Concatawhat?
|
59
|
-
|
60
|
-
Here's a big word for you: __concatenation__. It's a mouthful, but luckily for
|
61
|
-
you, it means something really simple:
|
62
|
-
|
63
|
-
first_name = "Steve"
|
64
|
-
last_name = "Klabnik"
|
65
|
-
alert first_name + last_name
|
66
|
-
|
67
|
-
See what I mean by addition? The _+_ lets us __concatenate__ the two Strings
|
68
|
-
together. The first name goes up front, and the last name goes in the back. Nice
|
69
|
-
and easy.
|
70
|
-
|
71
|
-
### Interpawho?
|
72
|
-
|
73
|
-
Okay, since you did so well with that word, I'm going to throw another one at
|
74
|
-
you, while you're still trying to recover: __interpolation__. It kinda means
|
75
|
-
'put into.' See if this makes sense:
|
76
|
-
|
77
|
-
first_name = "Steve"
|
78
|
-
alert "The first name is #{first_name}".
|
79
|
-
|
80
|
-
Whoah! What's up with that? Try running it, and see what it does.
|
81
|
-
|
82
|
-
### They're like pincers
|
83
|
-
|
84
|
-
Terrible analogy alert: See that { and its partner in crime, }? These two _curly
|
85
|
-
braces_ are like the pincers of some strange species of crab. You can put
|
86
|
-
whatever you want between them, and they hold your info in place in the middle
|
87
|
-
of a string.
|
88
|
-
|
89
|
-
|
90
|
-
Oh, and the # (a _hash_), is a funky hat the crab wears. Or something. I dunno.
|
91
|
-
Point is, you need all three parts, #{} and something in the middle. And that's
|
92
|
-
__interpolation__.
|
93
|
-
|
94
|
-
## Arrays
|
95
|
-
|
96
|
-
### The 411
|
97
|
-
|
98
|
-
### Concatination
|
99
|
-
|
100
|
-
### A short shout-out to Modules
|
101
|
-
|
102
|
-
### Not a treasure map...
|
103
|
-
|
104
|
-
### Gotta collect 'em all!
|
105
|
-
|
106
|
-
## Hashes
|
107
|
-
|
108
|
-
### A slightly different Array
|
109
|
-
|
110
|
-
## Putting them together
|
111
|
-
|
112
|
-
### Arrays of Arrays
|
113
|
-
|
114
|
-
### Arrays of hashes
|
115
|
-
|
116
|
-
### Hashes of hashes
|
117
|
-
|
118
|
-
### Hashes of Arrays
|
119
|
-
|
120
|
-
## Summary
|
121
|
-
|
122
|
-
### Good job!
|
123
|
-
|
124
|
-
Awesome! You should be prepared to play around with all kinds of data now. Keep
|
125
|
-
up all the good work!
|
data/content/datastrucs.md
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "Data Structures"
|
3
|
-
---
|
4
|
-
|
5
|
-
# Beginner Data Structures
|
6
|
-
|
7
|
-
## Hello there!
|
8
|
-
|
9
|
-
### Let's get started
|
10
|
-
|
11
|
-
Welcome to your first lesson about Data Structures! Now that you know how to
|
12
|
-
obtain data with Ruby you're also going to be able to store it in collections.
|
13
|
-
Arrays and Hashes are two key classes in Ruby that are able to help with
|
14
|
-
storing your data! Let's get going!
|
15
|
-
|
16
|
-
Click the icon like this (on the bottom of the screen) to get started:
|
17
|
-
|
18
|
-

|
19
|
-
|
20
|
-
### Lesson Controls
|
21
|
-
|
22
|
-
Before we move on, Here's a refresher on the controls you can use to move around
|
23
|
-
in the Lesson.
|
24
|
-
|
25
|
-

|
26
|
-
__back__: goes back one page
|
27
|
-
|
28
|
-

|
29
|
-
__continue__: goes to the next page
|
30
|
-
|
31
|
-

|
32
|
-
__menu__: makes it easy to jump around to any lesson
|
33
|
-
|
34
|
-

|
35
|
-
__close__: closes the tutor
|
36
|
-
|
37
|
-
Don't forget! Press this to move to the next part:
|
38
|
-
|
39
|
-

|
40
|
-
|
41
|
-
Have at it!
|
42
|
-
|
43
|
-
### What are Arrays?
|
44
|
-
|
45
|
-
An array can be thought of as a dresser where each drawer is a numbered spot.
|
46
|
-
This dresser is a collection of slots where one thing can be in each place.
|
47
|
-
Arrays are used to store data like numbers, strings, or even other Arrays!
|
48
|
-
Ruby makes it really easy to create and store things inside of them. Let's get
|
49
|
-
going!
|
50
|
-
|
51
|
-
### What can we do with them?
|
52
|
-
|
53
|
-
my_array = [1,2,"shoes"]
|
54
|
-
|
55
|
-
Try typing this and press the Run button.
|
56
|
-
|
57
|
-
You created an array with the numbers 1, 2, and the string 'shoes' in it.
|
58
|
-
Things in the array can be gotten by typing the array's variable name
|
59
|
-
(`my_array`) and square brackets (`[]`) with a number inside of the brackets.
|
60
|
-
This number can be though of as the address to that spot in the array. It's
|
61
|
-
good to remember that arrays start at 0 in Ruby.
|
62
|
-
|
63
|
-
alert my_array[0]
|
64
|
-
|
65
|
-
What thing in the array are you going to get back? Type this in and press the
|
66
|
-
'Run' button.
|
67
|
-
|
68
|
-
### Arrays in action!
|
69
|
-
|
70
|
-
When using Arrays we need to know a few things first. Arrays in Ruby can expand
|
71
|
-
to the size that you need them. So if you wanted to put the string 'cat' at
|
72
|
-
spot 99(which would be the 100th item in the array) we could put:
|
73
|
-
|
74
|
-
my_array[99] = "cat"
|
75
|
-
|
76
|
-
If there is nothing in a spot you will have 'nil' filling it.
|
77
|
-
|
78
|
-
If we wanted to print out everything in an array we could do something like
|
79
|
-
this:
|
80
|
-
|
81
|
-
my_new_array = ["cat","dog","mouse"]
|
82
|
-
|
83
|
-
Then we would put:
|
84
|
-
|
85
|
-
my_new_array.each {|animal| alert animal}
|
86
|
-
|
87
|
-
Type this all in and press the 'Run' button.
|
88
|
-
|
89
|
-
### Arrays in even more action!
|
90
|
-
|
91
|
-
We've seen what we can do with arrays, but what other things can they do to help
|
92
|
-
us? What if we had an array of numbers and we wanted to sort it? Try typing
|
93
|
-
this this and running it:
|
94
|
-
|
95
|
-
num_array = [4,3,22,19,100,45]
|
96
|
-
|
97
|
-
alert num_array.sort
|
98
|
-
|
99
|
-
That was really easy to sort it from lowest to highest! What if we want it from
|
100
|
-
highest to lowest though? Type this in next and press the 'Run' button.
|
101
|
-
|
102
|
-
alert num_array.reverse
|
103
|
-
|
104
|
-
The array class has so many methods that you can call upon it. Take a look on
|
105
|
-
the Ruby API: http://www.ruby-doc.org/core/classes/Array.html
|
106
|
-
|
107
|
-
## The Hash
|
108
|
-
|
109
|
-
### What are Hashes?
|
110
|
-
|
111
|
-
Now that we've gotten an introduction to Arrays we can also learn about Hashes!
|
112
|
-
Hashes in other languages are sometimes called Dictionaries. Well, what do they
|
113
|
-
do? Like in a dictionary you are able to look up a word or 'key' which
|
114
|
-
corresponds to a 'value'. You separate the key and value with a hashrocket
|
115
|
-
(=>). Just like Arrays you can access a certain key by typing the hashes
|
116
|
-
variable name and the key in square brackets ([]). Let's try working with a
|
117
|
-
hash!
|
118
|
-
|
119
|
-
my_hash = { "dog" => "puppy", "cat" => "kitten" }
|
120
|
-
|
121
|
-
alert my_hash["dog"]
|
122
|
-
|
123
|
-
Try typing this all in and press the 'Run' button!
|
124
|
-
|
125
|
-
### Working with Hashes
|
126
|
-
|
127
|
-
So what else are we able to do with hashes? Let's try something will help us
|
128
|
-
see if something is in the hash as a key or value The methods `has_key?` and
|
129
|
-
`has_value?` are exactly what we're looking for!
|
130
|
-
|
131
|
-
new_hash = { "1" => "one", "2" => "two"}
|
132
|
-
|
133
|
-
alert new_hash.has_key?("1")
|
134
|
-
|
135
|
-
alert new_hash.has_value?("one")
|
136
|
-
|
137
|
-
Try typing these in and press the 'Run' button for each of the methods!
|
138
|
-
|
139
|
-
### Let's tie these Hashes and Arrays together!
|
140
|
-
|
141
|
-
We've looked at two different data structures that are able to hold data for us
|
142
|
-
and let us access certain parts of the collections. Both Arrays and Hashes are
|
143
|
-
commonly used by programmers and are great to have knowledge about! Both of
|
144
|
-
these data structures have so many methods that can be read about in the Ruby
|
145
|
-
Documentation: http://www.ruby-doc.org/core/. Now with Arrays and Hashes you
|
146
|
-
should be able to keep your data organized and usable!
|