NYU — Spring 2014 / Week 1

Getting up to speed

We’ll do normal first-day things, like talk about why we‘re all here and what we want. Class goals and policies, introductions, office hours, grading policies, project overview, configuring our laptops, signing up for tutorial and presenation duty.

Finally, we’ll get inspired by some code we see online and use it for a quick demonstration.

Housekeeping

Introduction

How Amanda Got Started Intern Delightful boxes The dots are real

How Kevin Got Started Grad school Intern Peaked

2013: The Year in Interactive Storytelling

Learn to think like Amanda or Kevin

Discussion:

Getting your machines set up

  1. Everyone should download a text editor to their laptop, if they have one.

    For Mac users, we strongly recommend Sublime Text 2. It eventually costs $70, but you can use it for free for a while. (Kevin still uses the free version and he uses it every day.) Other alternatives include TextWrangler (free) or BBEdit (not free).

    PC Users might consider Notepad++.

  2. Next, we need to make sure Git is installed on all our computers. Here’s a helper. If you have a Mac, you probably have it installed already. We’ll do this together.

Signing up for Github

If you’ve never used Git or Github before, don’t worry, it’s not as scary as it may seem at first. It’s basically like Dropbox for programmers, with enough goofy names and concepts to make it all feel a little more complicated than it really is.

  1. First, go to Github and create a username and password, etc. .

  2. Once you are logged in, click on “Create a repository.” You should see this screen: Name your repo data-journalism-home. Make sure you check “Initialize this repository with a README”. Finally, click the button that says Create repository.

  3. Switch the branch from master to gh-pages. (It has to be called gh-pages to take advantage of some built-in magic with Github Pages.)

  4. Copy the clone url on the bottom-right.

  5. We’ve made a siccessful Git repository (called a repo). Nice! Now all we need to do is copy it to our computers.

  6. Go to your home directory, it’s the one in your sidebar with a house icon. Kevin’s is called “kevin” and the keyboard shortcut to go there is: ⌘⇧H

  7. Inside this folder, create a new folder called data-journalism-spring-2014. This is where we’re going to store our repository (and, later on, where we’ll put other ones).

  8. Open up the Terminal application on your Mac and navigate to the folder you just created. (We’ll do some practice, too.) For later, here are some decent resources, from Codeacademy and Stanford.

  9. Once you’re “inside” your folder on the Terminal, type git clone and then the URL you pasted from earlier. (For Kevin, it’s git clone https://github.com/kpq/data-journalism-home.git), but yours will be slightly different.

  10. Open up the folder in a text editor (like Sublime or whatever you prefer). Create a new file called index.html and write

    <h1>Hello, world!</h1>
    
  11. Save the file and view it in a web browser. How does it look?

  12. Let’s use git and the Terminal to push it back to Github. Type this in the Terminal. (Hit enter after each line.)

    git add .
    git commit -m "added index page, this is a commit message"
    git push origin master
    
  13. If it worked, you should be able to go to your web page (github.com/yourUserName) and see the result. And, after a while, if you’re on the gh-pages branch, you shoudl have a public-facing web site on yourUserName.gitub.io/. Sweet!

If there’s time: using an online example.

Say you want to make an interactive map of the United States and you don’t know where to start, but you DO know what you want your map to look and behave pretty much like this one you’ve already seen.

What’s next?

  1. Open the page in a separate window and view the page source.
  2. Copy all the code and paste it into a new file in your text editor. Call it week-1-map.html and save it into your class folder.
  3. Open the file in a browser.
  4. Say your data is not people per square mile but something else per state – say, dollars raised for a political campaign. Where does this map get that data from?

  5. If you can, find the data and save a local copy. Then edit the data for New York and see what happens.

  6. Broadly speaking, how can you use this example going forward?

Homework

Your assignment is to:

  1. Have your github page publishing correctly before the next class. For now, that means yourusername.github.io should be rendering your index.html page with your name and the phrase “Useful links for Kevin and Amanda.” (We’ll be adding more links later.)

  2. Bring data from all 50 states (or enough to be interesting) to class. This data should be of the type that could be shown on a map.