Debugging Safari web application on iOS devices

The idea here is to be able to use Safari’s developer tools connected to the web page/application running on a real iOS device. You can achieve similar effect by using XCode’s Simulator app, but certain things don’t work there (looking at you, Apple Pay).

Enable USB internet sharing

  • Open System Preferences > Sharing
  • Select Internet Sharing
  • If the checkbox next to Internet Sharing is enabled, uncheck it
  • Check iPhone USB on the right side
  • Check Internet Sharing on the left side. You will have to confirm it
  • Find message saying: “Computers on your local network can access your computer at: xxxx.local”. The xxxx part is the host. You will need it later.

Make your application available on the new host

Now it’s necessary to make your application available on the new xxxx.local host. In nginx it is a matter of adding xxxx.local to the server_name directive:

server_name existing.server xxxx.local;

For rails server it’s necessary to bind to all local interfaces:

rails server -b

Connect your iOS device

  • on iOS go to Settings -> Safari -> Advanced and toggle “Web Inspector”
  • on Mac open Safari and go to Preferences -> Advanced and check “Show Develop menu in menu bar”
  • connect iPhone via USB cable
  • on Mac restart Safari
  • on iPhone open http://xxxx.local
  • on Mac open Safari and go to the Develop menu. You will now see the iOS device you connected to your Mac. Click on it to start debugging.


Sometimes Safari won’t show the connected iOS device. If that is the case, you can start with restarting Safari both on the iOS device and Mac. If that doesn’t work, restart the iOS device and then the Mac.

Transproc is awesome!

I’m a big fan of the Elixir programming language, so when I saw at one of the Trójmiasto Ruby Users Group meetings that its pipe operator (|>) can be imitated in Ruby, I was immediately hooked. In Elixir you use it like this:

  |> * 3))
  |> Enum.filter(odd?)
  |> Enum.sum

Which means that the result of the preceding expression/function will be passed as the first argument to the next function. This allows writing code, which looks beautiful. Sure, it’s just a syntactic sugar, but what a beautiful one.

Now in Ruby, you can achieve a very similar thing if you use the transproc gem by our own Piotr Solnica. It’s a little bit more cumbersome as this is not built in into Ruby.

Let’s say you have a Hash, which you would like to transform to deep symbolise the keys and rename one key. Here’s how you do it:

require 'transproc/all'

# create your own local registry for transformation functions
module Functions
  extend Transproc::Registry

  import Transproc::HashTransformations

class SomeClass
  def transform hash hash


  def transformation
    t(:deep_symbolize_keys) >> t(:rename_keys, user_name: :name)

  def t *args

And if you now run it you’d get this as a result:

irb(main):022:0> hash = { 'user_name' => 'Paweł', 'country' => 'PL' }
=> { "user_name" => "Paweł", "country" => "PL" }

irb(main):023:0> hash
=> { :country => "PL", :name=> "Paweł" }

Neat, isn’t it?

Ruby 1.9.2 via rvm installation woes

I’ve just had to upgrade Ruby to 1.9.2 (from 1.8.7) on the EC2 instance, but ran into a weird error while running rvm install 1.9.2:

Compiling yaml in /home/ubuntu/.rvm/src/yaml-0.1.4.
ERROR: Error running 'make ', please read /home/ubuntu/.rvm/log/ruby-1.9.2-p290/yaml/make.log
Installing yaml to /home/ubuntu/.rvm/usr
ERROR: Error running 'make install', please read /home/ubuntu/.rvm/log/ruby-1.9.2-p290/yaml/make.install.log

and in the log:

src/ Libtool library used but `LIBTOOL' is undefined
src/   The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
src/   to `' and run `aclocal' and `autoconf' again.
src/   If `AC_PROG_LIBTOOL' is in `', make sure
src/   its definition is in aclocal's search path.

Fortunately the solution was rather simple, although Google was not really that helpful this time, hence this post:

sudo aptitude install libtool

Basically the libtool library was not installed.

Dream notebook for 2010

Would include:

  • 14-15″ OLED screen
  • <1,0 kg weight
  • 100GB on-board integrated SSD (pushing 1GB/s read/write speeds)
  • >3GHz Core i3/i5 (yet TBA on 2010/1/3)
  • no ide, no sata, no cd/dvd/bluray just USB 3.0 and hdmi

All of this is possible to make. No new technology needed. There are SSDs on PCI-E. There are OLEDs like this (AUO, LG). There are laptops on CULV processors below 0,8kg (Vaio X). There is just not a single laptop (not even announced!) that would combine it all.

I’m quite positive there would be lots of folks willing to pay the premium price (around 3-4K$ should be sensible) for this package. I would probably buy it for 50% a year later. Sadly, this system is just a dream.

On the other hand – I’m certain we will see similar designs in 2012/2013.

Happy New Year!

Update: Concept 16″ OLED Dell laptop is here. That’s a first.

Synecdoche, New York

Great movie and a great quote (or rather a monologue):

Everything is more complicated than you think. You only see a tenth of what is true. There are a million little strings attached to every choice you make. You can destroy your life every time you choose. But maybe you won’t know for 20 years and you may never, ever trace it to its source.

And you only get one chance to play it out. And they say there is no fate, but there is, it’s what you create. And even though the world goes on for eons and eons you are only here for a fraction of a fraction of a second.

Most of your time is spent being dead or not yet born. But while alive, you wait in vain wasting years for a phone call or a letter or a look from someone or something to make it all right. And it never comes, or it seems to, but it doesn’t really. So you spend your time in vague regret or vaguer hope that something good will come along.

Something to make you feel connected.
Something to make you feel whole.
Something to make you feel loved.

And the truth is I feel so angry.
And the truth is I feel so fucking sad.
And the truth is, I’ve felt so fucking hurt for so fucking long.
And for just as long, I’ve been pretending I’m okay just to get along, just for…

I don’t know why. Maybe because no one wants to hear about my misery because they have their own. Well, fuck everybody.

– Amen.