Book’em, Github.

Technical book authors now post source code archives and even entire books on GitHub. Here are some of the best.

When working through a technical book, the accompanying source code can be a lifesaver. We’ve all had moments when, for whatever reason, the example in Listing 5.1 simply won’t compile. Sometimes it’s a typo, sometimes it’s simple reader error, but whatever the cause, the source code typically includes code that’s in working order. Increasingly, authors are hosting source code on Github, which is great, because attentive readers can fork the code and update, debug, or expand on it.

Cooking with Steve (Jobs)

Erica Sadun’s mildly controversial The iPhone Developer’s Cookbook is the first cookbook for the iPhone SDK. I’ve found the current edition of the book a great reference when I’m stuck on something, but even without the book the code (in process of being updated for the iPhone 3.0 edition of the book) is a gem on its own. The first few projects are great examples of the very basics (if you’re into reading code); the later projects are great intermediate and advanced examples.

The examples related to rarely- or sparsely-documented features of the phone are especially helpful. Ms. Sadun’s explanations of the iPhone’s networking facilities are fantastic, with working applications for more advanced topics such as asynchronous downloading from the Web. The sample code also includes a simple TwitPic uploader that’s a canonical example of how to post multipart uploads to a web service.

The Github repository also covers a lot of the newer features of the iPhone SDK 3.0, such as GameKit, a framework for peer-to-peer messaging over Bluetooth geared towards multiplayer games. The source archive includes a really slick audio chat program with support for Bluetooth, Bonjour, and other protocols. One of my favorite sets of examples is the set of push notification projects. Everything is demonstrated, including a neat little push utility for Twitter.

I could go on and on about what’s in there (examples on gestures, shake to undo, how to get the battery state, shake to edit, multitouch, touch resize and rotate, getting the orientation, and tons more), but it’d probably be better if you just dug around in the repository yourself at http://github.com/erica/iphone-3.0-cookbook-.

Seeking Clojure

If you haven’t seen Clojure yet, think of it as Lisp on the JVM. It gives you all the power of the JDK with a really slick functional language. Until recently, Clojure documentation and examples haven’t been very accessible: if you have no functional programming experience, the material is somewhat opaque. Fortunately, Stuart Holloway wrote his excellent Programming Clojure book and published his source code to Github at http://github.com/stuarthalloway/programming-clojure.

The examples here range from the dead simple “Hello, world” (with a twist!), to more advanced topics. The projects include some good examples of interoperability with Java, and a few examples showing of the JDK’s networking capabilities. My favorite is the simple concurrency example. Functional programmers often talk about how great these languages are for concurrency, but a simple but purposeful example is hard to find. Stuart’s example is spot on.

All of the code is excellent, but perhaps the best feature is that each application includes its own test suite! If you’re confused about how to use an example or if the example doesn’t make sense, read the testable units to get a glimpse into the code.

Git it!

Scott Chacon (a Github employee) recently finished his book Pro Git. It’s a great book that you can read online at http://progit.org/, but even better, Scott released examples from the book and the book itself on Github. The text’s source (at http://github.com/progit/progit) is written in Markdown, and is a testament to how clean and easy writing in Markdown can be (I write all my columns in Markdown, actually). Scott has also been pulling in forks from Github users that have begun translating his book into various languages. If you’re curious (like me) about the toolchain for building a book from Markdown, check out the latex folder which has a few scripts to build a PDF from the Markdown source.

In a separate repository at http://github.com/progit/book-examples/, Scott has included a few examples of scripts from the book, including a full, sample ACL set of hooks and a cool basis for a custom Git importer. The book talks about how to import from other common SCMs, but if you use an exotic SCM variety, then this script makes it dead simple to import a directory and its files into Git.

A Veritable Potpourri

As always, there are a number of small projects from other books.

Peepcode (http://peepcode.com) has recently been dipping its toes into the eBook publishing market, and one of my favorite books from them is Jarkko Laine’s Unobtrusive JavaScript. It’s a fantastic little book on writing proper Prototype and general JavaScript code (even though you could take most of the principles and easily apply them to other libraries). Jarrko has included the source for the examples in an easy to understand Rails application at http://github.com/jarkko/unobtrusive_book_code.

Authors aren’t necessarily the only people to publish code from their books on Github. The Hashrocket team is working through Russ Olsen’s Design Patterns in Ruby and publishing its examples at http://github.com/hashrocket/design_patterns_in_ruby. These are great for reference if nothing else.

A few people have worked through Toby Segaran’s Programming Collective Intelligence book and translated the examples to other languages, but Mischa Fierer’s collection seems to be the most complete. All of the examples have been translated to Ruby. You can check them out at http://github.com/mischa/collective_intelligence.

If you’re interested in the code from my book, then check out http://github.com/assaf/ruby-in-practice.

As always if you dig up something interesting, contact me on Github at jeremymcanally or Twitter at @jm.

Comments on "Book’em, Github."

debt free car insurance its own same amount auto insurance companies want larger online auto insurance covered company auto insurance quotes providers

two quotes insurance quotes car say hotels insurance auto quote age groups companies decided auto insurance quotes those worst

sure though insurance quotes car young offer car insurance quote women owners policies cheapest auto insurance buy insurance insurance auto quote really worth caused over car insurance quote teen should someone insurance auto insurance while law car insurance quotes kind

want car insurance quotes take happen auto insurance factors many lender cheap car insurance spend ample

work auto insurance quotes its new minimum auto insurance quotes some auto premiums affordable auto insurance road rules colorado auto insurance car lucky policy again insurance car accident ordinary insurance auto insurance quote house policy going auto insurance insurance

good option cheap car insurance quotes trans union best rates cheap auto insurance maintaining primary car insurance ones uk zimbabwe car insurance offer courier service car insurance see

good enclosed auto insurance insurance adjusters today cheap car insurance speaks engineers architects insurance car quotes looking car insurance household products

Leave a Reply