Your awesome tagline

Month

December 2010

36 posts

Dec 30, 2010
Dec 28, 2010
Dec 28, 2010265 notes
Dec 28, 2010133 notes
Igor & Red Elvises → redelvises.com
Dec 27, 2010
Dec 27, 2010
Dec 27, 20101,087 notes
Dec 26, 20102 notes
Hackety Hack 1.0 - learn programming with Ruby → github.com

thechangelog:

Merry Christmas everybody! Full disclosure: this is my particular gift to Open Source, and future programmers everywhere.

Hackety Hack is a project that I inherited from _why. It’s the best way for people who’ve never learned programming to get their feet wet. It uses Ruby, combined with a GUI toolkit named Shoes, another _why project, to make it really easy to make all kinds of animations, games, and other applications.

Here’s an example bit of code:

label, time = nil, Time.now

Shoes.app :height => 150, :width => 250 do
  background "rgb(240, 250, 208)"

  stack :margin => 10 do
    start = button "Start" do
      time = Time.now
      label.replace "Stop watch started at #{time}"
    end
    stop = button "Stop" do
      label.replace "Stopped, #{Time.now - time} seconds elapsed."
    end
    label = para "Press start to begin timing."
  end
end

Here’s a screenshot of this in action:

As you can see, it uses Ruby’s blocks extensively.

Shoes isn’t just for really simple apps. Hackety Hack is itself written entirely in Shoes. :) Here’s an example of Pong in Shoes:

http://www.youtube.com/watch?v=b37OibG0BBk

The source code for this actually comes with Hackety, as an example. It’s about 50 lines

There’s also a web application that it integrates with. You can upload the programs that you make and then share them with other people.

Anyway, enough chatter. Enjoy your holiday! Merry Christmas!

[Github] [Website GitHub] [README] [Website] [Development Mailing list]

Dec 25, 201019 notes
Dec 24, 2010231 notes
Dec 22, 20102 notes
snap - a Haskell web framework → github.com

thechangelog:

Yes, you heard me right. Yesterday, the Snap framework had its 0.3 release. If you haven’t heard of Haskell before, you’re in for a treat.

I’ll try to keep this short. Haskell is a functional programming language. This makes it a bit different than the procedural or object oriented languages you’re probably used to. The syntax looks much more like math notation than code:

f :: Int -> Int
f x = x + 1

This reads “f is a function that takes an Int and returns an Int, and f of x is equal to x + 1.” For more about Haskell, check out Haskell.org. I could talk forever about how interesting and different Haskell is.

Enough about that. Let’s get back to Snap. To install Snap, use cabal, the Haskell package manager:

$ cabal install snap

Next, make a directory and create a project:

$ mkdir hello-snap
$ cd hello-snap
$ snap init

This gives you a directory with a .cabal file and a source directory. Then try this:

$ cabal install
$ hello-snap -p 8000
$ curl 'http://localhost:8000/'; echo

This’ll compile your website (yes, you read that correctly, Haskell is compiled), start a server on port 8000, and then request the homepage.

That’s all fine and dandy, but what’s the code look like? Well, if you look at the handler in Site.hs, you’ll find this:

site :: Application ()
site = route [ ("/",            index)
             , ("/echo/:stuff", echo)
             ]
       <|> fileServe "resources/static"

While the syntax may be foreign, you can get the gist of it: We route ‘/’ to index, and anything starting with ‘/echo/’ to an echo handler. Otherwise, serve a file from the resources/static directory.

What about one of these handlers? Here’s the echo handler:

echo :: Application ()
echo = do
    message <- decodedParam "stuff"
    heistLocal (bindString "message" message) $ render "echo"
  where
    decodedParam p = fromMaybe "" <$> getParam p

Don’t be scared! It’s easy. Repeat after me: echo is an Application. When it’s called, we first decode the “stuff” parameter and bind it to message. We then use a Heist template and bind the “message” string inside to our message we created from the parameter, passing that along and using it to render the “echo” template. Oh, and that decodedParam method that we used to set up the message earlier gets the parameter we asked for, (p) and yields either it or an empty string. You can find a much more thorough explanation of this in the documentation, which is excellent.

So what’s new in v0.3? There are three big improvements, as far as I’m concerned:

  • SSL support
  • “Development Mode”, which means you don’t need to recompile your site every time you change your code. This is a big benefit to getting things done quickly.
  • an extensions mechanism for writing reusable components.

If you’d like to see an entire website written with Snap, the Snap website is itself written in Snap, which is also on GitHub.

[GitHub] [README] [Website]

Dec 21, 201017 notes
Dec 21, 2010
Snap Framework v0.3... fuk yeh! → reddit.com
Dec 21, 2010
Dec 21, 201052 notes
Dec 21, 20105 notes
Dec 19, 2010
Dec 19, 2010
Dec 19, 20101,122 notes
Dec 18, 2010
Next page →
2012 2013
  • January 5
  • February 18
  • March 12
  • April 4
  • May 9
  • June 2
  • July
  • August
  • September
  • October
  • November
  • December
2011 2012 2013
  • January 2
  • February
  • March 1
  • April 9
  • May 28
  • June 16
  • July 14
  • August 11
  • September 13
  • October 14
  • November 12
  • December 19
2010 2011 2012
  • January 28
  • February 6
  • March 9
  • April 6
  • May 10
  • June 14
  • July 5
  • August 19
  • September 12
  • October 7
  • November 9
  • December 6
2010 2011
  • January
  • February 6
  • March 6
  • April 12
  • May 2
  • June 5
  • July 2
  • August 1
  • September
  • October
  • November 1
  • December 36