51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PairUp
2 | ======
3 |
4 | This repository powers pairuptocode.com, which hosts the exercises for PairUp events.
5 |
6 | A PairUp is an event where people come, get paired up with people of their level, and hack on a project for a few hours.
7 | The goal is for them to learn something new, practice their skills, and experience pairing.
8 | It's based on an event series called Protonight.
9 |
10 |
11 | How do you run a PairUp?
12 | --------
13 |
14 | 1. Find a venue that preferably has pairing stations, like a local immersion school. We held ours at DevBootCamp in SF.
15 | 2. Pick an appropriate date and time. We went for a Saturday morning, 10-12:30, with free breakfast at the beginning and optionally
16 | going out for lunch after.
17 | 3. Advertise the event. Specify in the description what the levels are (1: HTML/CSS, 2: JS, 3: Advanced JS), and ask attendees what level they think they are at. Here's how we advertised it: http://www.meetup.com/Girl-Develop-It-San-Francisco/events/109903322/
18 | 4. Find TAs that can help answer questions at the different levels.
19 | 5. Prepare sets of name badges based on the attendees count. Put different stickers for each level, and create pairs of name badges by writing the same letter twice on each name badge of a particular level. (Like Lions A, Lions B, etc.)
20 | 6. Set out those name badges next to "Level 1", "Level 2", "Level 3" at the event.
21 | 7. Start off the event by having everyone introducing themselves, then call off each level and letter so that each person finds their pair.
22 | 8. Make sure that each pair has found a pairing station and figured out an appropriate exercise to work on in the first 15 minutes or so.
23 | 9. Keep walking around and checking to see if anyone has questions.
24 | 10. Put up a "Wall of Wisdom" with post-its, and encourage everyone to write up what they learn at the end of the PairUp.
25 |
26 | We are welcoming ideas to improve our event. Please send us an email to gabriela.osu@gmail.com or tweet me at @EvaGZamudio
27 |
28 | 
29 |
--------------------------------------------------------------------------------
/downloads/HTMLCSSexercise.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/evagabriela/pairup/54fbba1b8122d317dec909bfda18e3d106dc6c88/downloads/HTMLCSSexercise.zip
--------------------------------------------------------------------------------
/exercises/bootstrap.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CSS: Bootstrap Exercise
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
32 | Uh oh! Have you had your daily dose of veggies today??
33 |
34 |
35 |
Wild & Wacky Vegetables
36 |
37 |
The beet is the most intense of vegetables. The radish, admittedly, is more feverish, but the fire of the radish is a cold fire, the fire of discontent not of passion. Tomatoes are lusty enough, yet there runs through tomatoes an undercurrent of frivolity. Beets are deadly serious.
38 |
You can use something like repl.it to code this so that you don't need to worry about making a webpage, or you can create a whole webpage for it, with inputs and buttons. You may want to start off with just JS and then add the UI later, but it's up to you.
Write a function called squareNumber that will take one argument (a number), square that number, and return the result. It should also log a string like "The result of squaring the number 3 is 9."
32 |
Write a function called halfNumber that will take one argument (a number), divide it by 2, and return the result. It should also log a string like "Half of 5 is 2.5."
33 |
Write a function called percentOf that will take two numbers, figure out what percent thebfirst number represents of the second number, and return the result. It should also log a string like "2 is 50% of 4."
34 |
Write a function called areaOfCircle that will take one argument (the radius), calculate the area based on that, and return the result. It should also log a string like "The area for a circle with radius 2 is 12.566370614359172"
35 |
36 |
Bonus: Round the result so there are only two digits after the decimal.
37 |
38 |
Write a function that will take one argument (a number) and perform the following operations, using the functions you wrote earlier1:
39 |
40 |
Take half of the number and store the result.
41 |
Square the result of #1 and store that result.
42 |
Calculate the area of a circle with the result of #2 as the radius.
43 |
Calculate what percentage that area is of the squared result (#3).
44 |
45 |
46 |
47 |
48 | function squareNumber(num) {
49 | var squaredNumber = num * num;
50 | console.log('The result of squaring the number ' + num + ' is ' + squaredNumber);
51 | return squaredNumber;
52 | }
53 |
54 | squareNumber(3);
55 |
56 | function halfOf(num) {
57 | var half = num / 2;
58 | console.log('Half of ' + num + ' is ' + half);
59 | return half;
60 | }
61 |
62 | halfOf(5);
63 |
64 | function percentOf(num1, num2) {
65 | var percent = (num1/num2) * 100;
66 | console.log(num1 + ' is ' + percent + '% of ' + num2);
67 | return percent;
68 | }
69 |
70 | percentOf(5, 10);
71 |
72 | function areaOfCircle(radius) {
73 | var area = Math.PI * squareNumber(radius);
74 | console.log('The area of circle with radius ' + radius + ' is ' + area);
75 | return area;
76 | }
77 |
78 | areaOfCircle(2);
79 |
80 | function doCrazyStuff(num) {
81 | var half = halfOf(num);
82 | var squared = squareNumber(half);
83 | var area = areaOfCircle(squared);
84 | var result = percentOf(squared, area);
85 | }
86 |
87 | doCrazyStuff(5);
88 |
Start with this webpage, which has an img of a cat walking, and JavaScript functions
30 | that animate the cat across the screen. (For all of these, you shouldn't need to touch the original code - just add code below.)
Bonus: Disable the start/stop/faster buttons at the appropriate times (e.g. the user shouldn't be able to click "stop" if the cat isn't currently moving.)
In this exercise, you'll create a webpage of many embedded elements. For some of these, you may have to google to figure out how to get embed codes - some sites make it easier/more obvious than others.
Create a new blank page with just a header (“All About Dogs”).
30 |
Add an embedded Google Map that shows dog parks in San Francisco.
31 |
Follow these instructions so that you are opening your page with an http:// URL instead of file://. Many embeds don't work off of file:// URLs, for various reasons.
32 |
Add Facebook comments to your page.
33 |
Add a Twitter button to the page.
34 |
Create a Google custom search engine that searches across multiple dog sites and embed the search box on the page.
35 |
For each of the embeds, add comments around them to show where they start and end, and add an h2 to split the page up into sections.
The point of this exercise is to learn to read, manipulate, and visualize data in JavaScript.
24 |
25 |
26 |
Find an interesting dataset in some sort of text format (XML, JSON, CSV, etc). Store the dataset in your project folder. Truncate it to a reasonable length if it’s very long (i.e. 1000 rows). Some possible sources are:
Create an empty webpage and load the dataset into your webpage using an AJAX or JSONP request. (See slides: AJAX/JSONP)
33 |
Display the data as a table with columns for each of the attributes. (See slides: HTML Tables)
34 |
Use the tablesorter jQuery plugin to make the table sortable. (See slides: jQuery)
35 |
Create a form above the table which lets users filter or manipulate the data somehow, i.e. a dropdown box to only show rows matching a particular query, or a way of summing up attributes. Whatever would be useful with the data. (See slides: DOM, Events)
Add a script tag to the bottom of the page for your code.
49 |
Add an event listener to the button so that it calls a makeMadLib function when clicked.
50 |
In the makeMadLib function, retrieve the current values of the form input elements, make a story from them,
51 | and output that in the story div (like "Pamela really likes pink cucumbers.")
52 |
53 |
54 |
55 |
56 | function libIt() {
57 | var storyDiv = document.getElementById("story");
58 | var name = document.getElementById("name").value;
59 | var adjective = document.getElementById("adjective").value;
60 | var noun = document.getElementById("noun").value;
61 | storyDiv.innerHTML = name + " married a " + adjective + " " + noun + "... So weird!";
62 | }
63 |
64 | var libButton = document.getElementById('lib-button');
65 | libButton.addEventListener('click', libIt);
66 |
In this exercise, you'll make a HTTP Status Cat memory game -- you can see
27 | a screenshot of a sample solution on the right. A memory game consists
28 | of an even number of tiles with images on one side and a generic back.
29 | Each image appears on precisely two tiles. You start the game with all
30 | tiles turned face down, and proceed to flip over two tiles at a time.
31 | If the two tiles have the same image, they remain face up. If not,
32 | they're flipped face down again after a short delay. The goal of the
33 | game is to get all the tiles flipped face up (i.e., find all the
34 | matching image pairs) in the least number of tries.
35 |
36 |
37 | We'll make the game more fun by using random HTTP Status Cat images from HTTP Status Cats
38 | because their images follow a regular naming scheme so we can avoid
39 | scraping image URLs from sites by hand. The HTTP Status Cat.com image URLs
40 | follow the pattern https://http.cat/[statuscode]NNNN where NNNN
41 | is a sequentially assigned number. Some experimentation shows that most
42 | of the range between100 and 599 works well, though a few of the
43 | images are missing. (If you happen to pick a missing one, which HTTP status cat would you expect to appear?)
44 |
45 |
Here are some suggested steps for building the game:
46 |
47 |
48 |
Write the HTML for the game's page, displaying a grid of face-down tiles. You can use any image you want for the tiles' backs, but make sure it's not easily confused with the HTTP Status Cat pictures, so it's clear whether a tile is face up or face down. You'll probably want to use a <table> to lay out the tiles, and set the width and height of each image by hand. You can either write the table by hand into your HTML file, or write code to generate it dynamically using document.createElement and appendChild.
49 |
Write code to pick a bunch of random HTTP Status Cat image URLs and stick two copies of each URL into an array, then randomize the order of the array (using the code from the previous exercise). You might also take this opportunity to preload the images so there'll be no delay when they're flipped over for the first time. Make the preload images visible for now so you can verify that you're forming the URLs correctly.
50 |
Assign one HTTP Status Cat URL from the randomized array to each tile. The easiest way to attach the URLs is to store them in a made-up attribute (e.g. facesrc) right on the DOM image elements. The browser will ignore any attributes it doesn't understand, but you'll be able to retrieve them later in your code when handling click events on the elements. (Note though that Firebug will not show your custom attribute in the DOM pane.)
51 |
Attach a click handler to each tile that will turn it face up. Make sure that clicking on tiles that are already face up does nothing.
52 |
Add a timeout handler when a tile is turned face up that will flip the tile face down again after a short delay (e.g., 500 milliseconds).
53 |
Add the game logic that keeps track of the tiles that are face up and reacts appropriately based on whether they match or not.
54 |
55 |
56 |
You should now have a working game! Have fun playing it and tweaking it to really make it your own. Here's a few suggestions for extra features you could add:
57 |
58 |
Add an outline around "active" tiles (flipped up but not yet matched) so it's clear which tile the player is currently trying to match.
59 |
Add a timer or move counter to make the game more competitive. (For the timer, window.setInterval() could prove useful.)
60 |
When the game is over, allow the player to see the full-size HTTP Status Cat pictures from the tiles.
61 |
Allow the player to start a new game with a button, rather than by reloading the page. You could also allow them to pick the size of the board to play on.
The goal is to use the CSS position property to create a webpage that looks like the one below.
27 |
Here's what it looks like with a window width of 800x530:
28 |
29 |
30 |
31 |
32 |
33 |
Here's what it looks like when the window is 400x475 - notice how elements resize:
34 |
35 |
36 |
37 |
38 |
39 |
Here are recommended steps for making this happen:
40 |
41 |
Create a blank web page with just html, head, body, and a style tag.
42 |
Change the background of the page to be a sky blue and have a background image of clouds.
43 |
Create a div for the grass - position it at the bottom and give it an appropriate height.
44 |
Create a div for the "Farm Party!" banner - position it near the top center area, and style the text so that it's red. For a bonus, use a fun custom font (like from Google Web Fonts) and give it the appearance of a black stroke.
45 |
For each of the images shown, search for an appropriate image on Google Image search - it doesn't have to be the exact same. Try searches like "sheep animated gif" and if you need to, restrict the results to just "clip art". When you find the image, create a img for it on the page.
46 |
Position each of the img elements appropriately. The sheep should be around the bottom left, the cow should be on the horizon, the dude should be dancing in the middle, the tree should be on the front right, and the sun should be around the upper right.
47 |
As a bonus, position a picture of your face on top of the dude, and watch yourself have a farm party!
You'll create a simple word guessing game where the user gets infinite tries to guess the word (like Hangman without the hangman, or like Wheel of Fortune without the wheel and fortune).
27 |
28 |
29 |
Create two global arrays: one to hold the letters of the word (e.g. 'F', 'O', 'X'), and one to hold the current guessed letters (e.g. it would start with '_', '_', '_' and end with 'F', 'O', 'X').
30 |
Write a function called guessLetter that will:
31 |
32 |
Take one argument, the guessed letter.
33 |
Iterate through the word letters and see if the guessed letter is in there.
34 |
If the guessed letter matches a word letter, changed the guessed letters array to reflect that.
35 |
When it's done iterating, it should log the current guessed letters ('F__') and congratulate the user if they found a new letter.
36 |
It should also figure out if there are any more letters that need to be guessed, and if not, it should congratulate the user for winning the game.
37 |
38 |
Pretend you don't know the word, and call guessLetter multiple times with various letters to check that your program works.
39 |
Bonus: Make it more like Wheel of Fortune:
40 |
41 |
Start with a reward amount of $0
42 |
Every time a letter is guessed, generate a random amount and reward the user if they found a letter (multiplying the reward if multiple letters found), otherwise subtract from their reward.
43 |
When they guess the word, log their final reward amount.
44 |
45 |
Bonus: Make it like Hangman:
46 |
47 |
Keep track of all the guessed letters (right and wrong) and only let the user guess a letter once. If they guess a letter twice, do nothing.
48 |
Keep track of the state of the hangman as a number (starting at 0), and subtract or add to that number every time they make a wrong guess.
49 |
Once the number reaches 6 (a reasonable number of body parts for a hangman), inform the user that they lost and show a hangman on the log.
50 |
51 |
52 |
53 |
54 |
55 | var wordLetters = ['G', 'O', 'A', 'T'];
56 | var guessedLetters = ['_', '_', '_', '_'];
57 |
58 | function guessLetter(letter) {
59 | var goodGuess = false;
60 | var moreToGuess = false;
61 | for (var i = 0; i < wordLetters.length; i++) {
62 | if (wordLetters[i] == letter) {
63 | guessedLetters[i] = letter;
64 | goodGuess = true;
65 | }
66 | if (guessedLetters[i] == '_') {
67 | moreToGuess = true;
68 | }
69 | }
70 | if (goodGuess) {
71 | console.log('Yay, you found a letter!');
72 | console.log(guessedLetters.join(''));
73 | if (!moreToGuess) {
74 | console.log('YOU WON!');
75 | }
76 | } else {
77 | console.log('Oh noes, thats not right!');
78 | }
79 | }
80 |
81 | guessLetter('G');
82 | guessLetter('I');
83 | guessLetter('O');
84 | guessLetter('A');
85 | guessLetter('T');
86 |
Note: Before you explore the YouTube API, you need to check Developers Console and create the appropriate credentials to ping the API.
30 |
Go to the Youtube API docs and read through them. Look at the sample output and the example URLs for the API. Find a URL that will give you search results, and test that out in the browser.
31 |
The webpage currently brings in video information using the jQuery $.ajax function to bring in a local videos.json file into the page. Change that function so that it instead brings in the results of a Youtube API search from the Youtube servers and displays those results instead. Search for whatever you fancy, but limit the search to 5 results.
32 | Tips: Remember that the JSON that the Youtube API returns will be different than the JSON format of videos.json. You should console.log inside your callback to see what the data looks like and make sure you're using it correctly. In particular, check how they store the ID, the author, and the rating.
33 |
34 |
Bonus: Create your own playlist on Youtube of your favorite videos, and bring that into the page instead.
35 |
Bonus: Add a search button to the page so that people can search for any query.
36 |
37 |
38 |
Make sure that you use your browser developer tools to make debugging easier while working on this. Check for errors, and use console.log() to figure out how far your code makes it, and what the values of your variables are along the way.
';
7 | mainDiv.innerHTML += shareLink;
8 |
9 | function loadShare() {
10 | var shareHTML = '
To make a public URL, you can copy your HTML into jsbin.com and copy that URL. Or, if its a few files, you can host on Google Drive. Then, post in the comments below with a link to it. Or tweet it at @GDIsf. Or both!