A Veritable Scatter Shot!

Github offers something for every developer. This week, read about some obscure and not so obscure software recently posted on Github.

This week presents a scatter shot of projects I stumbled upon recently. It’s got everything from JavaScript, to Ruby, to languages you’ve probably never even heard of.

JavaScript-taculous!

Prototype (http://github.com/sstephenson/prototype) is one of the most popular open source JavaScript frameworks, and one of the most popular libraries to use with Prototype is scriptaculous, an excellent visual effects (fades, slides, and so on) library. This week, Thomas Fuchs, the author of scriptaculous, announced the availability of scriptaculous 2.0 (at http://github.com/madrobby/scripty2). This version is a total rewrite from the ground up, cleaning up the internals, speeding things up, and generally making the library better.

2.0 adds a good number of things to the core and improves many existing features. My favorite is CSS morphing, which smoothly transforms from one CSS style to another on a given element.

For example, to transition from white text on a black background to black text on a white background, you can call Element.morph. First, link to the JavaScript source files for Prototype and scriptaculous:

<script src="prototype.js" type="text/javascript"></script>
<script src="s2.js" type="text/javascript"></script>

Next, add the JavaScript code. Prototype finds elements using their `id` attribute; in this case, we’ll find an element named “black” and morph its CSS.

$('black').morph('background: white; color: black;');

It’s as easy as that. Now you’ll have a really smooth transition between the two CSS states. You can adjust nearly any CSS property in this manner, even queueing the effects up or running them in parallel. Read more about what’s possible at http://scripty2.com/doc/.

I Hate PowerPoint, Too.

If you’re like me, opening up PowerPoint or Keynote is an exercise in self-discipline. I love giving presentations, but presentations tools can be incredibly infuriating. Fortunately, I’ve found a neat little tool from Pat Nakajima I plan to start using called Slidedown, which lets you write slides in Markdown (my personal markup language preference).

An example slide file might look like this:

!SLIDE

# Welcome to my talk.

!SLIDE

## This is an awesome talk

!SLIDE code

  @@@ ruby
    def with
      some_code(:here)
    end
  @@@

!SLIDE

More information is [on my site](http://jeremymcanally.com)

This little bit generates four slides, one with some syntax highlighted Ruby code on it (yes, it highlights it!). The result is an HTML file and a set of CSS styles you can tweak to customize the look of your slides. To check out Slidedown, see the repository at http://github.com/nakajima/slidedown.

Feeling Obscure?

Erlang and Scala are obscure languages. Nonetheless, more and more developers are using these languages in real world projects, no matter how small, thus following much the same arc that Ruby and many of its predecessors have followed. Haskell is also an obscure languages—albeit popular among math geeks, scientists, and, strangely, financial developers for some time—but a few recent developments have sparked attention from a wider audience. One of the latest is Hack (http://github.com/nfjinjing/hack), a Haskell port of Ruby’s Rack Web server interface library.

Hack is a library that makes building Web frameworks and Web services dead simple; it also connects those frameworks to a Web server. All the logic to handle the framework-server communication is abstracted away, leaving a simple yet powerful API.

For example, to build a simple “Hello, universe!” application in Hack, you’d do something like this:

import Hack
import Hack.Handler.Happstack
import Data.ByteString.Lazy.Char8 (pack)

app :: Application
app = \env -> return $
  Response 200 [ ("Content-Type", "text/plain") ] (pack "Hello, universe!")

main = run app

This code imports the Hack library, creates an Application instance, adds an action to it to return Hello, universe!, and then executes the action. Haskell is a compiled language. Save the code to a file, say, Web.hs), build it (using GHC here), and run it.

$ ghc --make -O2 Web.hs
$ ./Web

The application runs on http://localhost:3000. If you’re interested in Hack, check out the repository (http://github.com/nfjinjing/hack), or if you’re interested in learning more about the Haskell language itself, check out http://haskell.org.

Speaking of Obscure…

Reia (http://github.com/tarcieri/reia) is a really interesting project, not only because it’s a very obscure language that runs on an obscure-turning-mainstream virtual machine (the Erlang VM), but because, unlike Erlang, it’s a concurrent language that’s actually quite fun to write code in. It’s billed as a hybrid between Ruby and Python, but in my experience, it leans more towards the Ruby side (which probably explains why it’s so fun to play with).

For example, check out this simple example:

class Person
  def initialize(name)
    @name = name
  end

  def say_hello
    "Oh, hello.  My name is #{@name}!".puts()
  end
end

person = Person("Jeremy")
person.say_hello()

If you know Ruby, you likely see a number of differences, but Reia still retains some of the same feel and it’s a great language that gives you nearly all the benefits of Erlang without a lot of the syntax quirks. If you want to learn more about Reia, be sure to check out the website at http://reia-lang.org.

That’s it for this week! Be sure to keep those suggestions coming to jeremymcanally on Github or @jm on Twitter.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62