This week I made a tiny bit of progress on my Git Blame Light table plugin. Deciding that the Node Git library that we were using - js-git - had documentation that had fallen totally out of sync with the actual library, moved on to use another one called simple-git, and 2 lines of code later, was able to clone a Git repo from clojurescript. Yay!
(def simple-git (js/require (str path-to-node-modules "simple-git"))) (.clone repo git-repo "/Users/madhu/src/hackerschool/test1/" #(println %))
Pretty sweet. Post this, I decided to take a break from the plugin to do other small important things. Pairing with HaSc facilitator, Tom, I learnt how to have a better workflow on the terminal. I'd always been a fan of split screen terminals, but never got around to setting it up. Now I have an iTerm based set up, and finally, split screens(Too late, yes). I also have a better mental model of how Vim plugins work, differences between Pathogen and Vundle to manage the plugins, and can finally, find my way around using different plugins. Went on to set up Fireplace.vim for Clojure, and it's definitely making life easier.
So then, I wanted to build something shiny and worry about my light table plugin later. Tom suggested I build a ray tracer, and having no clue what it was, decided it must be built. I talked to another hackerschooler who is an expert at Computer Graphics, and understood how ray tracers work. I thought it might be a good idea to build it using a language that had good Math support, and decided to do it in Julia. I'm close to seeing some output, however bad it might be, but still figuring out how the imaging library works in Julia. Will hopefully have some shiny pictures tomorrow :D
I started the week thinking I should build a plugin for LightTable, the awesome opensource IDE built in clojurescript. I learnt loads reading Chris Granger's blog on the Behavior Object Tag(BOT) model that Light Table uses. When I started reading the IDE's code, it amazed me how easily one could edit code inside the same IDE and reload it and there! you have your new editor. I've always viewed editors like an end user, I may even write a plugin, but play around with the code? /me thinks Eclipse. Nah. But playing with LightTable was so incredibly easy!
Starting with forking the example Declassifier plugin, we got rid of all it's functionality to create our own brand new Hello World plugin. First thing - compile error. git blame_compiled.js -> File not found. The compiled JS file had no space in it, but it was looking to load one with a space. Then we figured that naming it as "Git Blame" in the plugin.edn file caused it, and changing it to "GitBlame" fixed it. Was LightTable not handling the names right? Plan was made to fix that first and submit a pull request :D
To our disappointment, it kinda was doing the right thing. Our behaviors file listed the JS file to look for, and did not have a space in the name. So it was generating a file as dictated by plugin.edn and looking for the file as mentioned in behaviors. So if they are consistently named, it worked fine. Hmmm.
So then we made our very own Hello World plugin. And what did it do? Alert Hello World on every key press. And then one had to endure that until we got rid of the code and restarted Light Table in order to escape our abominable plugin.
In order to integrate Git, we found this library called js-git, and after finding how to use node modules within clojurescript, tried playing with it. Got stuck at the point where we were clueless how to write callback functions that js-git required, at which point we suspended working on it. Need to get back to it this week.
Interestingly though, in the process of hacking LightTable, I broke it somehow (no clue how to replicate it), so that file save in LightTable wouldn't work. That also made me wonder how easy it is to break this IDE! One foolish programmer is all it takes.
I made progress on the Algorithms, and Intro to Stats course. I learnt about Random selection and Minimum Cut of graphs this week, and of course, implemented those in Clojure :) The stats class has gotten a lot math formulae-ish though, what with Binomial distributions and all that.
The theme of the job related friday activities this week was to build a bitly like URL shortener. It's a simple web app, and felt trivial to do in Python/Flask or frameworks I've worked a lot with, so I used the chance to explore HTTPKit and figure out how to do it using Clojure. The HttpKit library was a breeze to use to set up a simple server, although I'm yet to wrap my head around the WebSocket and Long Polling functionalities it offers. I never finished building a URL shortener, but hey, I learnt what I wanted to.
Halfway across. Halfway to go.
The weather in New York seemed to look up this week. Well it at least started that way. It was 15°C on tuesday evening. Deciding to make full use of that, a friend and I went on a long walk on the West Highway, on this beautiful sidewalk by the Hudson river, overlooking the Jersey city.
There is a pedestrian bridge running half way across the river, and just standing and staring at the river, the Statue of Liberty at a far distance, is one serene experience.
While on serene, I visited the Cloisters Museum last Sunday, and that was one beautiful walk too. To reach the Medieval Architecture themed stunning museum which is all the way uptown, there is a walk uphill through a park. The snow still hasn't cleared on this pathway, and it overlooks the Hudson, and if I had a choice, I'd just do this walk everyday. The Cloisters was a great visit, although the gardens were closed off because of the winter. Hopefully, I'll get to visit it when the sun shows up again.
Wednesday, was one rainy day. One would ideally stay indoors. So I was dragged to "indoor" rock climbing once again, by my awesome climber friend from HackerSchool :D I attempted to boulder this time, din't even get very far at the lowest level of difficulty, but meh.
More weather rant. It was -7°C on Thursday. How did that even happen? Don't people go crazy? In lieu of the terrible weather, I had super awesome Indian dinner at Hell's kitchen. To the tunes of Kajrare :D
And did I mention? I live a few blocks from Central Park and haven't been there yet. Up until Friday. I made it finally. Met a couple of friends there, took a nice long walk, followed up by Thai food. More walking yesterday. My college friend from Pittsburgh was in town, and it being all bright and sunny, we walked up the Brooklyn Bridge and went around Times Square. One awesome week full of awesome walks.
This week I did a bunch of different things, but I've made one discovery. I am addicted to Clojure. In all the languages I've tried to write in, this one took the longest to get the hang of, but it's been worth it. It just, feels great to think in this language.
On the note of the game I built last week, I code reviewed it with one of our awesome facilitators, Zach and gained super useful insights on writing clearer and concise Clojure code. I learnt about associating metadata with collections, and insight into how to better structure code. That was an incredibly useful 2 hours spent. I also talked about how I built the game for this Thursday's presentations.
I made progress on my Statistics course, and also started on the Coursera Algorithms Part 1 course with a bunch of folks at HackerSchool. This is awesome, because I've never been able to get past first week in any online course, but doing it with a peer group, discussing and solving problems together keeps me socially committed and also helps understand stuff better than I did before. I implemented MergeSort(in Clojure, of course) for the first weeks problems, and on the second week now.
For problem solving Friday, pairing with people at HackerSchool, I built QuickSort, and partly on a Scrabble dictionary based puzzle which I'm only half done with. (Does wrote it in Clojure go without saying?)
I've also started to dabble with LightTable, the awesome IDE built in ClojureScript. The plan for next week is to write a plugin for LightTable and also pick up ClojureScript on the way - I've gotten upto HelloWorld now on that. What the plugin will do, is still under construction. All I know is that it needs to use my new found interest awesome plugin - core.async - somehow.