Shoes, Socks & Presentations

After listening to Steve Klabnik‘s talk in RubyConf India, I really wanted to try Ruby and Shoes as well. After messing with it for few hours, I came up with Socks.

Socks is a Shoes app that takes in data in JSON format and renders them on screen. Its designed to be used as slides for presentations, so supports only text and images.

The best part is that you define your GUI in a declarative language in the JSON format. This is very much simpler to the CSS styles, so its real easy to get started. Moreover your slides are just your data, so you can write software on any platform to read them. (Data freedom? Yeah!)


[ { "data" : "This is socks!",
"styles" : { "align" : "center",
"font" : "Ubuntu",
"stroke" : "#f00"
},
"type" : "banner"
},
{ "data" : "The partner of Shoes in presentation. You just write a plain JSON File, and we take the pains of creating the presentation for you.",
"styles" : { "stroke" : "#666" },
"type" : "para"
}
]

view raw

slide2.json

hosted with ❤ by GitHub

This produces a window like this:

socks2

Or you could write:


[ { "data" : "Hello World!",
"styles" : { "align" : "center",
"font" : "Ubuntu",
"stroke" : "#f00"
},
"type" : "banner"
},
{ "data" : "I am Sankha",
"styles" : { "stroke" : "#666" },
"type" : "para"
},
{ "data" : "res/me.jpg",
"type" : "image"
}
]

view raw

slide1.json

hosted with ❤ by GitHub

socks1

You can put all this together and Socks will create a nice presentation for you.


{ "margin" : 10,
"name" : "Demo Presentation",
"slides" : [ [ { "data" : "Hello World!",
"styles" : { "align" : "center",
"font" : "Ubuntu",
"stroke" : "#f00"
},
"type" : "banner"
},
{ "data" : "I am Sankha",
"styles" : { "stroke" : "#666" },
"type" : "para"
},
{ "data" : "res/me.jpg",
"type" : "image"
}
],
[ { "data" : "This is socks!",
"styles" : { "align" : "center",
"font" : "Ubuntu",
"stroke" : "#f00"
},
"type" : "banner"
},
{ "data" : "The partner of Shoes in presentation. You just write a plain JSON File, and we take the pains of creating the presentation for you.",
"styles" : { "stroke" : "#666" },
"type" : "para"
}
],
]
}

view raw

example.json

hosted with ❤ by GitHub

It renders just text and images now. Go give it a try, its on GitHub. Any help for Socks is appreciated, so just fork and send me a pull request!

Why should you be at RubyConf India

Warning: This post is a non-Rubyist’s take on RubyConf India. Forgive me for my inaccuracies.

I’ll accept it right at the beginning, I don’t do Ruby (forget Rails), having dabbled with it previously I knew just bits of it. And when I got the opportunity scholarship, there was no reason not to go.

Reason #1: Ruby is nice, and so is the the Ruby community. Trust me, the Ruby community is one of the best that I’ve ever seen in my life. People are so friendly, progressive, open to discussions and ideas. Really amazing!

Reason #2: The star cast at RubyConf India is pretty good. Let me list it out – we had Steve Klabnik, Jim Weirich, Aaron Patterson, Andy Lindeman, Nick Stutter, etc. Nothing is better that hearing the best from the pros.

Reason #3: So many stories at one place. Yes, you get to hear the stories of so many people – each being an inspiration in itself. The times when Aaron Patterson says he is a college dropout thrice, denied the opportunity to study at University of Washington but then goes and teaches there for years, you feel no matter how bad the situation is, you can always get better.

Reason #4: Ruby is for everyone – BRails. This really drew my attention – how much do we think about the physically challenged when developing products? Siddhant’s though visually impaired served as an eye-opener for everyone. He had be developing with Ruby and Rails for quite a few years – and developing teaching materials for the others.

Reason #5: You can do cool stuff with Ruby and rediscover old school concepts again. Places where representation of the data matter more than just numbers. Parallelism can be both your friend and enemy (just like MRI and JRuby can be), how you can dive into Unix system calls from Ruby itself. Last but not the least a bit of Rock and Roll with Ruby doesn’t hurt either. For those who are wondering, what I am blabbering you should take a look at the list of talks.

Bonus Reason: The beer parties after conferences are always awesome.

Personal Takeaway: Do more Ruby and use it for more of my personal projects. There is a lot that can be done with it.