Why I don't like HTML surrogate template engines

Preamble

Mostly it is about template engines (that hide away real HTML) in Ruby (as due to app runtime specific it is very easy to add pre-compiled "sweets" there, and everybody do it). But in general such tpl engines could exist in any server side language.
I don't like DSLs and abstractions that lead me away from the "origin". Ok, a careful reader have already got what will I write further :)
This post is not about "stop using it" or "it is bad", it is about "reconsider is it really so useful".

Let's start with examples

This just a small subset of all existing engines, that I have herd of, just to have an examples. Each language has it's specific, but mostly script web languages are good template engenes by themselves.

And I am really absolutely fine with most of them. Except those that force own HTML-replacement surrogate (it is Slim, HAML or JADE like).

 body
    h1 Markup examples

    #content
      p This example shows you how a basic Slim file looks like.

      == yield

      - unless items.empty?
        table
          - items.each do |item|
            tr
              td.name = item.name
              td.price = item.price
      - else
        p
         | No items found.  Please add some inventory.
           Thank you!

And now I'll try to explain this...


Read more ...

Yii2 component: yii2-gon. Push variables from PHP to JS.

This component publishes json serialisable data as 'key -> value' from PHP code into global JS variable window.gon.

Why?

The need for such an extensions came while working on web apps with mixed approach: rich JavaScript GUI on web page, but each page is reloaded and most of bussiness logic is still on the backend side.

The simples solution for a quick prototyping is pushing a data from PHP controller to global JS variable. That makes you free from a lot of REST API getters (you can make a lot without an API at all). So I did the first protype of this extension during "EU Web Challenge 2015" tasks coding. And now publish it as a standalone package.

Idea is inspired by Ruby gem gon https://github.com/gazay/gon (the name is taken from it too. "GON" authors - in case of any naming issues, just ping me :))


Read more ...

Local tunnels. Exposes your localhost dev server to global internet.

The solution for a question "how do I expose a local server behind a NAT or firewall to the internet?". Literally when your dev machine does not have a dedicated IP, but you need to...

  • make a demo of localhost web app (and can not deploy it to some server)
  • make a quick test of web app (api) on your mobile device
  • accept a webhook from some service or oAuth redirect

Local tunnels allows you to easily share a local web service development machine without messing with DNS and firewall settings. And here are some free tools...


Read more ...

Fix issues with Ruby installation (via rvm) in Ubuntu 15.10

ruby Got an error while trying to install Ruby via RVM and RBENV on Ubuntu 15.10.

compiling ossl_ssl.c
ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3),
...
Makefile:293: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
...
exts.mk:201: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
...
make: *** [build-ext] Error 2

Solution #1

Apply patch during installation

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | rbenv install --patch 2.2.3

Read more ...

How to install Elance Tracker in Ubuntu 15.04, 15.10

Elance Tracker

My previuos post explained how to install Elance Tracker on Ubuntu 13.10 - 14.10, but from 15.04 libgnome-keyring version is changed. This is updated version of the installation script.

  • Here is one quick script. Save it as install_adobe_air.sh
#!/bin/bash
apt-get install -y libgtk2.0-0:i386 libstdc++6:i386 libnss3-1d:i386 lib32nss-mdns libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386
cd /tmp
apt-get download libgnome-keyring0:i386
dpkg-deb -R libgnome-keyring0_3.12.0-1build1_i386.deb gnome-keyring
cp gnome-keyring/usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/i386-linux-gnu/
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/i386-linux-gnu/libgnome-keyring.so.0
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0
wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin -O  /tmp/AdobeAIRInstaller.bin -q
chmod a+x /tmp/AdobeAIRInstaller.bin
/tmp/AdobeAIRInstaller.bin -silent
rm ./AdobeAIRInstaller.bin
rm /usr/lib/libgnome-keyring.so.0
rm /usr/lib/libgnome-keyring.so.0.2.0
  • Make it executable sudo chmod a+x install_adobe_air.sh
  • And run sudo ./install_adobe_air.sh (during running Abode Air wizard will appera, you should go through it)
  • Then download Elance Tracker for Linux as usual and install it in normal way

Read more ...
Ievgen
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in PHP and Ruby, play with JS/Node.JS, evaluate Elixir, explore databases, use Ubuntu and MacOS, think about IT people and management

Notes