Idiomatic Clojure with LightTable
LightTable, the famous innovative IDE (slash reactive work surface, as described by the author) recently got some pretty amazing additions: user defined plugins and user defined custom expressions.
Custom expressions allow users to define functions that get any block of text and replace with the result, stream information back to LightTable, or display the result inline:
The clojure project Kibit immediately came to mind when I saw the new addition. Kibit is a static code analyzer for Clojure that allows you to find a more idiomatic way of writing a given block of text.
So I wrote this short LightTable integration for it. With it, LightTable can replace any s-expression with its more idiomatic version. For instance, this code:
becomes:
To see how Kibit did, here is the before and after shots of the expression broken down in its components:
After:
In order to use Kibit with LightTable, you just need to:
1. add lein-kibit it to your project.clj:
2. add the integration function to your usermap:
The sample project can be found on GitHub.
Viewing 3D Models directly on GitHub
A few months ago GitHub launched an amazing, albeit limited, support for viewing 3D models directly on GitHub. Since obj files were not supported, and are one of the most prominent 3D files on GitHub (with over 195 thousand files listed against 22 thousand stl files) I’ve created Three-hub.
Three Hub is an open source Chrome Extension that shows the 3D models from the model files when browsing GitHub. You can install it directly from Chrome Store. The source for the extension can be grabbed here.
Currently only obj formats are supported, but support for COLLADA, glTF and other formats will be added in the future.
Here are some amazing models you can see with it already:
Downgrading RubyMotion
RubyMotion is a great way of writing native iPhone apps using Ruby rather than good old Objective-C.
The excitement around it has not stopped at 37 signals’ post about Why I loved building Basecamp for iPhone in RubyMotion: many libraries creating very convenient APIs for doing all sorts of things were created. A non exhaustive list include BubbleWrap, Teacup, Futuristic, Motion-Xray.
As with any new piece of fast moving and new technology, deprecation moves fast. Recently I found myself picking up a open source library that was very useful, but did not keep-up with the platform’s pace, and therefore it would no longer build with the latest version of RubyMotion (which was a major number upgrade to version 2). Needing to build the original app in a few hours, I looked into how to downgrade my RubyMotion version.
I could not find anywhere how to do it, but thankfully RubyMotion’s support was quick to help me with it:
$ sudo motion update --force-version=1.35
And that was it. Back to having a lots of fun with IOs development.
WebGL breaking into the real world
A few weeks ago I attended the Khronos WebGL Meetup during GCD week. It was a pleasure to see how much amazing real companies got real work got done, many in just one year. Here are some of the highlights:
Shadertoy
A place to share and explore shaders created by many people. Kinda like Github, but for shaders.
Verold Studio
Verold is similar to Shadertoy, but for full 3D models.
Fractured: Fractal Att Studio
Amazing GPU accelerated fractal exploration tool. More on their post
Cesium
Cesium is an open source virtual globe and map engine (source on GitHub). They also have an online InstaREPL like tool.
Goo Engine
Goo engine (which showcases some pretty good demos) is both an 3D Game Engine in WebGL and a distribution mechanism.
Play Canvas
Play Canvas is also a 3D Game Engine in WebGL. Their amazing Doom 3 Gangnam-Style animation got a lot of attention recently.
Mozilla running Unreal Engine 3 on WebGL
Mozilla outdoing themselves again. After their great work with Banana Bread shooting game, they, alongside Epic Games, ported Unreal Engine 3 to WebGL. Well, WebGL and Emscripten optmized to be compiled to their also recently launched asm.js. It was announced a few days earlier, but the Mozilla team was showcasing some new impressive demos.
Moving towards more widespread adoption
At the end I got to chat with Brandon, who did some amazing work with webgl, and currently works on Google Chrome GPU team helping with WebGL development.
We talked about many things, including ASM.js which had just been announced. I also asked him what was the thing that was impeding WebGL to get more traction, and he shared his two cents: getting gigantic asset deployment is a pain. Most 3d applications have gigabytes of assets, and, comparitevely when you are downloading 2GB assets from Steam, you can go to work, leave your computer at home doing the work, come back, and you are done. Storing the assets and running these long requests on the browser is not yet as frictionless as it could be, and that adds barriers to developers going into WebGL.
Finally
If this is not enough, Florian Boesch recently wrote a great post on Why you should use WebGL
Navigating Git Branch History
In last years I’ve been collaborating in very large projects using git. More recently, one thing that started annoying me was branch switching, as git shell completion started requiring a lot of cycling over similar named branches. Worse: most of the time I just needed to cycle among a few branches at a time (usually one branch I’m fixing, master for quick experiments on what is in production, and finally my working feature branch).
Git reflog exposes out a quick way to do this, using the shorthand HEAD@{0}, HEAD@{1}. Unfortunately, this is a bit too fine grained, as commits are recorded into the reflog.
After learning a bit about git’s hooks, I wrote a simple utility called git-nav to help me. A sample usage (just put the git-nav script in your path to install):
$ git nav Creating post-checkout hook... Already on 'master' .... $ git commit c1 $ git checkout -b cool-feature ... $ git commit c2 $ git nav l Navigation History: (use 'git nav [number]' to go to that point ) 1 master $ git nav Switched to branch 'master' ... $ git commit c3 $ git checkout merge cool-feature .... $ git commit c4 $ git checkout 4e6bc147ee9074998ac0406c1a646d5d3bbeaced $ git checkout -b quick-fix $ git-nav Switched to branch 'master' $ git nav l Navigation History: (use 'git nav [number]' to go to that point ) 4 master 3 cool-feature 2 master 1 4e6bc147ee9074998ac0406c1a646d5d3bbeaced $ git nav 3 Switched to branch 'cool-feature'
So, it is pretty simple:
git-nav l : Lists your navigation history. git-nav [number] : Goes back to your navigation history by number steps. git-nav : Goes back to last branch. Same as git-nav 1.
If you think it may help you as well, you can grab it here.
Comments Off on Idiomatic Clojure with LightTable