Tuesday, December 2, 2014

notask

I never really got into gulp or grunt. To me it seems like a quick way to get not exactly what you want. I rather use make!

But make is not a javascript only solution, and I do love javascript only solutions. That, and my love for promises and angular led to notask, a simple task runner.

https://github.com/LuvDaSun/notask

A task lives in a file with a name like 'taskname.task.js'. It exports a 'task' member which is a function that may return a promise that will be resolved upon task execution. The task function may also have parameters. Every function parameter of a task references another task by it's name, just like angular does with services and such.

I hope you like it!


Saturday, November 1, 2014

develop anywhere

While travelling Thailand my mac-book pro was giving me a lot of trouble (makes me wonder why they call it pro). The keyboard and track pad locked up from time to time leaving me with only a beautiful retina display to look at. My girlfriends stepmother who lives in Kuala Lumpur knew a guy that was travelling to Bangkok and he brought us a brand new Samsung Chromebook from Kuala Lumpur, they don't sell those in Thailand (yet).

I really love the Chromebook, everything just works, there is no fan in it and it is quite cheap so even dared to use it on the beach. Well the track-pad is crappy, the screen is also crappy but for the rest it is great. However, developing on a Chromebook is not really possible.

So I fired up an EC2 instance with Ubuntu on amazon for do development and connect to it via my Chromebook, the crosh shell offers an ssh client, but I rather use the Secure Shell app because allows me to save my connections. I tried to connect to the server with the Cloud9 service, but had some trouble with that so I installed the open source version of Cloud9 on my server and make ssh tunnel to it via port 3131. Also I have tunnels to port 8080, 8081 and 8088, those are the ports I usually use for website projects.

Cloud9 via port 3131
Secure Shell configuration with port forwards
Now I can do some serious development via my Chromebook, or any device that has a SSH client. Yesterday I actually optimized a query in bed with JuiceSSH on my tablet using vi. I have peace of mind that if my Chromebook would breakdown, I could use really any computer to almost instantly continue my work, I could even use my tablet! I could even use my mac-book if it will ever work again!

I could attach a full size keyboard to my tablet and use it for development!
If I really wanted to, I could even do development on my phone!
Another advantage of this setup is that is makes it very easy to test my projects on a mobile device. Now that mobile device still needs a ssh tunnel, but i could just open up some ports to the world so it would be very easy to view a project on any mobile device. I could even let my client take a look at what I am working on very easy.

One thing that I a missing in this setup is a decent text-editor for my Chromebook that can connects to my server. I am used to Brackets and I would really love to have it on my Chromebook. I am actually quite happy with Cloud9, but it gets slow from time-to-time (that could also be a Chromebook problem) and it feels a little to IDE-ish. Or maybe it just takes a little getting used to.

Here's is what I use

  • One Amazon Web Services EC2 t2.micro instance with Ubuntu Server 14.04 LTS on it, located in the Singapore. I have an elastic ip address so I can shut down the instance and start it up again without the public ip-address changing.
    https://console.aws.amazon.com/ec2
  • Secure Shell on my Chromebook
    https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo
  • JuiceSSH on my tablet
    https://play.google.com/store/apps/details?id=com.sonelli.juicessh
  • On the server I have the open source version of Cloud9
    https://github.com/ajaxorg/cloud9
  • Happy tourist SIM, a thai sim-card with 4g and 12gb / month. Sometimes I use the wifi of the resort I am in, but my 4g connection is a lot faster! I got it from the airport in Bangkok.
    http://www.dtac.co.th/en/
  • A Samsung Chromebook.
    http://www.yes.my/v3/personal/devices/samsung-4g-chromebook.do
Here's what I do
  1. Startup my Chromebook
  2. Startup the EC2 instance
  3. Start my SSH session, including some tunnels
  4. Start Cloud9 on the server
  5. Go to http://localhost:3131 on the Chromebook
  6. Start developing!
Of course there are also disadvantages to this setup. One obvious one is that I always need internet for development and if the connection is crappy it will slow me down. Debugging device related stuff (for example Internet Explorer or Safari) could be a challenge, but then again, it always is and nowadays there are a couple of services that allow you to test on real devices in the cloud (like AppThwack or Perfecto Mobile).