<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Emilis Dambauskas @ GitHub</title>
 <link href="http://emilis.github.com/atom.xml" rel="self"/>
 <updated>2019-10-24T19:45:08+00:00</updated>
 <id>http://emilis.github.io/</id>
 <author>
   <name>Emilis Dambauskas</name>
   <email>emilis.d@gmail.com</email>
 </author>
 
 
 <entry>
   <title>On GitLab and keeping your privacy on the modern Web</title>
   <link href="http://emilis.github.io/2019/10/24/on-gitlab-and-keeping-your-privacy.html"/>
   <updated>2019-10-24T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2019/10/24/on-gitlab-and-keeping-your-privacy</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;TL;DR: If you are a privacy-conscious technical person, use &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/umatrix/&quot;&gt;uMatrix&lt;/a&gt; (or an alternative) and consider switching to &lt;a href=&quot;https://sourcehut.org/&quot;&gt;SourceHut.org&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;GitLab&lt;/strong&gt; has &lt;a href=&quot;https://news.ycombinator.com/item?id=21337594&quot;&gt;upset hackers&lt;/a&gt; with their &lt;a href=&quot;https://gitlab.com/gitlab-com/www-gitlab-com/blob/d3454a729d24025b2c31ca423672f8951062af93/source/posts/2019-10-10-update-free-software-and-telemetry.html.md.erb&quot;&gt;telemetry announcement&lt;/a&gt;. They have (wisely) back-tracked from it, but I don’t believe they changed their heart &lt;em&gt;yet&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I think this telemetry scandal was bound to happen. I have been expecting it since the day &lt;strong&gt;GitHub&lt;/strong&gt; was bought by &lt;strong&gt;Microsoft&lt;/strong&gt;. I evalued my options with &lt;strong&gt;GitLab&lt;/strong&gt; that day. &lt;strong&gt;GitLab&lt;/strong&gt; wasn’t respecting user privacy then and it has not changed since.&lt;/p&gt;

&lt;p&gt;Let me explain.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Lets go to the websites [that I know best] for hosting your open-source code.&lt;/li&gt;
  &lt;li&gt;Lets use &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/umatrix/&quot;&gt;uMatrix&lt;/a&gt; extension for &lt;a href=&quot;https://www.mozilla.org/en-US/firefox/new/&quot;&gt;Firefox&lt;/a&gt; and see what technologies from which domains are used.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;github&quot;&gt;GitHub&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/static/2019/github-umatrix.png&quot; class=&quot;full&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Works &lt;strong&gt;without JavaScript&lt;/strong&gt; – &lt;span class=&quot;label-green&quot;&gt;good&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;Tries to set &lt;strong&gt;4 cookies&lt;/strong&gt; without asking me first: &lt;span class=&quot;label-yellow&quot;&gt;not nice&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;No third-party&lt;/strong&gt; resources on page – &lt;span class=&quot;label-green&quot;&gt;great&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seems that they can take care of themselves without third parties involved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; now owned by a corporation that mainstreamed &lt;a href=&quot;https://en.wikipedia.org/wiki/Criticism_of_Windows_10#Privacy_and_data_collection&quot;&gt;vacuuming data from paying customers&lt;/a&gt; (telemetry).&lt;/p&gt;

&lt;h3 id=&quot;sourceforge&quot;&gt;SourceForge&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/static/2019/sourceforge-umatrix.png&quot; class=&quot;full&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Works &lt;strong&gt;without JavaScript&lt;/strong&gt; – &lt;span class=&quot;label-green&quot;&gt;good&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;Tries to set &lt;strong&gt;1 cookie&lt;/strong&gt; without asking me first: &lt;span class=&quot;label-yellow&quot;&gt;not nice&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;Third parties:
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;fsdn.com&lt;/strong&gt; Assuming it is owned by the same company. No way to check, because their Whois info is private. – &lt;span class=&quot;label-green&quot;&gt;kind of OK&lt;/span&gt;.&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;fonts.google.com&lt;/strong&gt; – &lt;span class=&quot;label-orange&quot;&gt;privacy-ignorant&lt;/span&gt; (&lt;em&gt;do I need to argue that using any resources from an advertising company and the biggest data-hoarder on the planet is at least ignorant?&lt;/em&gt;).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;a href=&quot;https://github.com/gorhill/uBlock/&quot;&gt;uBlock Origin&lt;/a&gt; still finds &lt;span class=&quot;label-red&quot;&gt;ad trackers&lt;/span&gt; on the page.&lt;/p&gt;

&lt;p&gt;Seems they care more about their own privacy than mine.&lt;/p&gt;

&lt;h3 id=&quot;sourcehut&quot;&gt;SourceHut&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/static/2019/sourcehut-umatrix.png&quot; class=&quot;full&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Uses &lt;strong&gt;no JavaScript&lt;/strong&gt; – &lt;span class=&quot;label-green&quot;&gt;great&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;No cookies&lt;/strong&gt; – &lt;span class=&quot;label-green&quot;&gt;excellent&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;No third-party&lt;/strong&gt; resources on page – &lt;span class=&quot;label-green&quot;&gt;great&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is what I call hacker-friendly.&lt;/p&gt;

&lt;h3 id=&quot;gitlab&quot;&gt;GitLab&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/static/2019/gitlab-umatrix.png&quot; class=&quot;full&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Works &lt;strong&gt;without JavaScript&lt;/strong&gt; – &lt;span class=&quot;label-green&quot;&gt;good&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;Tries to set &lt;strong&gt;1 cookie&lt;/strong&gt; without asking me first: &lt;span class=&quot;label-yellow&quot;&gt;not nice&lt;/span&gt;.&lt;/li&gt;
  &lt;li&gt;Third parties:
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;cdnjs.cloudflare.com&lt;/strong&gt; – &lt;span class=&quot;label-yellow&quot;&gt;not privacy friendly&lt;/span&gt;, bordering on &lt;span class=&quot;label-orange&quot;&gt;ignorant&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;cookiebot.com&lt;/strong&gt; – &lt;span class=&quot;label-yellow&quot;&gt;Not sure&lt;/span&gt; what it does. Sounds evil, but probably just annoys you with a cookie consent banner&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;fontawesome.com&lt;/strong&gt; – &lt;span class=&quot;label-yellow&quot;&gt;not privacy friendly&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;fonts.google.com&lt;/strong&gt; – &lt;span class=&quot;label-orange&quot;&gt;privacy-ignorant&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;bizible.com&lt;/strong&gt; – &lt;span class=&quot;label-red&quot;&gt;anti-privacy&lt;/span&gt; “&lt;em&gt;Bizible offers an integrated &lt;strong&gt;marketing analytics&lt;/strong&gt; platform for marketers to optimize their campaigns.&lt;/em&gt;”&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;googletagmanager.com&lt;/strong&gt;:
        &lt;ul&gt;
          &lt;li&gt;&lt;span class=&quot;label-danger&quot;&gt;privacy-hostile&lt;/span&gt;: Google: check. Google-&lt;strong&gt;tag&lt;/strong&gt;-manager: “tag” means “&lt;strong&gt;tracking pixel&lt;/strong&gt;”.&lt;/li&gt;
          &lt;li&gt;&lt;span class=&quot;label-danger&quot;&gt;security risk&lt;/span&gt;: Lets clueless &lt;strong&gt;marketers&lt;/strong&gt; inject JavaScript from any third-parties &lt;em&gt;of their choosing&lt;/em&gt; into the page. From my experience, the third-parties can look pretty shady. You are at risk of getting viruses, crypto-miners and other crap.&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don’t remember exactly what &lt;strong&gt;GitLab&lt;/strong&gt; was using on the day &lt;strong&gt;Microsoft&lt;/strong&gt; bought &lt;strong&gt;GitHub&lt;/strong&gt;. Also I was using &lt;a href=&quot;https://noscript.net/&quot;&gt;NoScript&lt;/a&gt; at the time.&lt;/p&gt;

&lt;p&gt;What I remember is that &lt;strong&gt;GitLab.com&lt;/strong&gt; looked at least anti-privacy (probably due to &lt;strong&gt;Bizible&lt;/strong&gt;). So I didn’t switch to it. I see no big difference between &lt;strong&gt;Microsoft&lt;/strong&gt; or &lt;strong&gt;Google&lt;/strong&gt; plus shady third-parties hoarding my data.&lt;/p&gt;

&lt;h3 id=&quot;what-you-can-do&quot;&gt;What you can do&lt;/h3&gt;

&lt;p&gt;What I did: I looked at &lt;a href=&quot;https://sourcehut.org/&quot;&gt;SourceHut&lt;/a&gt; and payed &lt;a href=&quot;https://git.sr.ht/~sircmpwn/&quot;&gt;Drew DeVault&lt;/a&gt; the &lt;a href=&quot;https://sourcehut.org/pricing/&quot;&gt;$20&lt;/a&gt; he asked for. Currently I use it as a backup of my repos. I hope to use it for development and collaboration some day.&lt;/p&gt;

&lt;p&gt;I have been using &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/umatrix/&quot;&gt;uMatrix&lt;/a&gt; for a few months now. It is developer-friendly, not user-friendly. Took some time until I got used to it. But now I enjoy it: I have granular control on &lt;em&gt;who&lt;/em&gt; runs &lt;em&gt;what&lt;/em&gt; on my computer.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/umatrix/&quot;&gt;uMatrix&lt;/a&gt; has also let me notice a &lt;strong&gt;hacked website&lt;/strong&gt; I was visiting: I noticed that the page was trying to access resources from localhost (127.0.0.1):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/static/2019/siuntu-sekimas-umatrix.png&quot; class=&quot;full&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The page was on a site I didn’t expect to be hacked: Lithuanian Post service. Not sure what the suspicious code was doing, but I reported it to the relevant authorities and it seems to be fixed.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>The root of all problems with JavaScript</title>
   <link href="http://emilis.github.io/2016/10/03/root-problem-with-javascript.html"/>
   <updated>2016-10-03T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2016/10/03/root-problem-with-javascript</id>
   <content type="html">&lt;ul&gt;
  &lt;li&gt;It is not its bad parts,&lt;/li&gt;
  &lt;li&gt;it is not its inconsistencies,&lt;/li&gt;
  &lt;li&gt;it is not its syntax,&lt;/li&gt;
  &lt;li&gt;it is not the dynamic typing,&lt;/li&gt;
  &lt;li&gt;it is not the event loop,&lt;/li&gt;
  &lt;li&gt;it is not the confusing prototypal inheritance,&lt;/li&gt;
  &lt;li&gt;it is not IE, Safari or other outdated browsers,&lt;/li&gt;
  &lt;li&gt;it is not the 300k npm packages,&lt;/li&gt;
  &lt;li&gt;it is not the 1k languages that compile to JavaScript,&lt;/li&gt;
  &lt;li&gt;it is not ES6, 7, 8, 2015, stage-1, stage-0&lt;/li&gt;
  &lt;li&gt;it is not the ton of tools you seem to need to build anything working,&lt;/li&gt;
  &lt;li&gt;it is not that your node_modules grew over a gigabyte in size,&lt;/li&gt;
  &lt;li&gt;it is not the Website Obesity Crisis&lt;/li&gt;
  &lt;li&gt;it is not the “new JavaScript framework every day” mentality,&lt;/li&gt;
  &lt;li&gt;it is not its users,&lt;/li&gt;
  &lt;li&gt;it is not its community&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The root of most problems is that developers have to use JavaScript if they need to build anything that works in a browser&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Let me rephrase: &lt;strong&gt;the biggest problem&lt;/strong&gt; with JavaScript is that it is so big and a lot of developers are &lt;em&gt;forced&lt;/em&gt; to use it.&lt;/p&gt;

&lt;p&gt;Naturally, all the developers who have to use it, try to fix their problems with the language or the available ecosystem in thousands of ways.&lt;/p&gt;

&lt;p&gt;I don’t think &lt;em&gt;everyone&lt;/em&gt; moving to Chrome, TypeScript, ES6, React, Webpack, 2 spaces, eslint-config-airbnb or anything else will solve any problems. It can only make matters worse.&lt;/p&gt;

&lt;h4 id=&quot;therefore&quot;&gt;Therefore:&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;I love ES6 and beyond, but admire developers who stick with ES3 and ES5,&lt;/li&gt;
  &lt;li&gt;I dislike TypeScript, but am interested in what their users are building,&lt;/li&gt;
  &lt;li&gt;I hate Angular, I use React – no problem,&lt;/li&gt;
  &lt;li&gt;I didn’t like Grunt or Gulp, I switched to Webpack.&lt;/li&gt;
  &lt;li&gt;I prefer to build my programs out of functions and expressions. I have no problem with people using pseudo-OOP as long as I don’t need to write their boilerplate and can use their methods as callbacks when needed.&lt;/li&gt;
  &lt;li&gt;I use 4 spaces, you use 2. Lets not start a flamewar. Lets grab a drink and talk about something more interesting instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;live-and-let-live&quot;&gt;Live and let live.&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Use what you love, but don’t push others to use it.&lt;/li&gt;
  &lt;li&gt;Embrace the methods and techniques you are using, but be open to learning from others.&lt;/li&gt;
  &lt;li&gt;Learn to distinguish between the things that are really important to you and that are minor annoyances.&lt;/li&gt;
  &lt;li&gt;Don’t be an asshole – it only hurts everyone.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;notes&quot;&gt;Notes&lt;/h3&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;I don’t think there &lt;em&gt;is&lt;/em&gt; a JavaScript community. There’s too much diverse stuff going on around. Front-end frameworks, back-end frameworks, 3d libraries, mobile platforms, vanilla style, embedded systems. The only most common factor may be npm… and still you could find tens of thousands of people who just add a bunch of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags to their page and build entire apps with it. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;Even if you use some other language and compile it to JavaScript, there will come the moment when you will have to use JavaScript when debugging some deep issue in your code. There is no escape. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>The BoundEmitter Pattern</title>
   <link href="http://emilis.github.io/2015/07/28/the-boundemitter-pattern.html"/>
   <updated>2015-07-28T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2015/07/28/the-boundemitter-pattern</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;a href=&quot;https://github.com/emilis/bound-emitter&quot;&gt;emilis/bound-emitter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I’ve been using EventEmitters quite much lately.
Usually I mix them into modules that need to allow subscription to some internal events.
However I am not content with the style of code they require.&lt;/p&gt;

&lt;p&gt;Consider this small example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some-storage.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var emitter =   new EventEmitter;

exports.on =    emitter.on.bind( emitter );
exports.once =  emitter.once.bind( emitter );
exports.off =   emitter.off.bind( emitter );
...
exports.write = function write( id, value ){
   ...
   emitter.emit( &quot;write&quot;, id, value );
   ...
};
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;some-logger.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var storage = require( &quot;./storage&quot; );

storage.on( &quot;write&quot;, console.log.bind( console, &quot;storage wrote:&quot; ));
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I don’t like that the code in logger.js has a magical value (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;write&quot;&lt;/code&gt;). Typos could happen anywhere, event names can change in the future. As a consequence the logger would not receive notifications about the event. More than this: this error would happen silently and you would probably notice it only by it’s confusing effects.&lt;/p&gt;

&lt;p&gt;Creating some object for holding the constant values:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some-storage.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
exports.EVENTS = { write: &quot;write&quot; };
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;…would not really solve the problem: you can still mistype it or change it. All that would happen is that instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&quot;wirte&quot;&lt;/code&gt; or some other &lt;em&gt;String&lt;/em&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;emitter.on()&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;emitter.emit()&lt;/code&gt; would get an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;undefined&lt;/code&gt; as it’s first parameter.&lt;/p&gt;

&lt;p&gt;So I thought what about this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some-storage.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
emitter.emit.write = emitter.emit.bind( emitter, &quot;write&quot; );
emitter.on.write =   emitter.on.bind( emitter, &quot;write&quot; );
...
exports.on =         emitter.on;
...
exports.write =      function write( id, value ){
    ...
    emitter.emit.write( id, value );
    ...
};
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;some-logger.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
storage.on.write( console.log.bind( console, &quot;Storage wrote:&quot; ));
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This way, if any typo occurs, or the event name is changed we would get instant errors in the style of “&lt;em&gt;TypeError: storage.on.write is not a function&lt;/em&gt;”. Easier to catch and debug.&lt;/p&gt;

&lt;p&gt;An added bonus: piping events becomes trivial:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some-cache.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
storage.on.write( emitter.emit.clear_cache_now );
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, I don’t like typing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;...bind( emitter, ...&lt;/code&gt; code all the time, so I wrote myself a small function. It takes an Array of event names:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;storage.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;...
var emitter =   BoundEmitter([ &quot;write&quot;, &quot;remove&quot; ]);

exports.on =    emitter.on;
exports.once =  emitter.once;
exports.off =   emitter.off;
...
exports.write = function write( id, value ){
    ...
    emitter.emit.write( id, value );
    ...
};
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BoundEmitter()&lt;/code&gt; returns an &lt;em&gt;EventEmitter&lt;/em&gt; with the proper &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;on.event / emit.event / ...&lt;/code&gt; functions created and bound to the context and the first argument.&lt;/p&gt;

&lt;p&gt;You can examine the code for it at &lt;a href=&quot;https://github.com/emilis/bound-emitter&quot;&gt;emilis/bound-emitter&lt;/a&gt;, or just install it and use via npm:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm install bound-emitter
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var BoundEmitter = require( &quot;bound-emitter&quot; );
...
var your_emitter = BoundEmitter([ &quot;create&quot;, &quot;update&quot;, &quot;remove&quot; ]);
...
your_emitter.emit.create( some_value );
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>How To Change Firefox Scratchpad Font Size</title>
   <link href="http://emilis.github.io/2014/06/19/howto-change-firefox-scratchpad-font.html"/>
   <updated>2014-06-19T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2014/06/19/howto-change-firefox-scratchpad-font</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;/static/2014/scratchpad-font.png&quot;&gt;&lt;img class=&quot;third&quot; src=&quot;/static/2014/scratchpad-font.png&quot; alt=&quot;Firefox Scratchpad with custom font&quot; /&gt;&lt;/a&gt;
I started using Firefox &lt;a href=&quot;https://developer.mozilla.org/en/docs/Tools/Scratchpad&quot;&gt;Scratchpad&lt;/a&gt; recently for some web scraping work. It is a very nice feature in the Firefox’ Web developer toolbox. It has various execution options. You can open it with a shortcut on any page (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shift+F4&lt;/code&gt;). You can open and save your code to the disk. It even has a Vim mode (set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;devtools.editor.keymap&lt;/code&gt; to &lt;em&gt;vim&lt;/em&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;about:config&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;However its default font size is too small for me. Until recently I found no way to change it. It does not react to general Content preferences, it didn’t change when I changed default font for Web developer tools in general. Only after some digging through Firefox internal code I found a way to change it.&lt;/p&gt;

&lt;p&gt;The trick is, you should use &lt;a href=&quot;http://kb.mozillazine.org/index.php?title=UserChrome.css&amp;amp;printable=yes&quot;&gt;userChrome.css&lt;/a&gt;. This file is located in the directory of your Firefox profile (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.mozilla/firefox/hash.profile/userChrome.css&lt;/code&gt;). If you don’t have the file – create it. The code below sets the font family and size both for Web developer tools and Scratchpad:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/*  Styles for Web developer tools */
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document regexp(&quot;chrome://browser/content/devtools/.*&quot;){
    * {
        font-family:    Droid Sans Mono, monospace;
        font-size:      10pt !important;
    }
}

/*  Styles for Scratchpad */
.CodeMirror,
.CodeMirror pre {
    font-family:    Droid Sans Mono, monospace;
    font-size:      10pt !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>What the situation in Ukraine means for me in Lithuania</title>
   <link href="http://emilis.github.io/2014/03/06/god-help-ukraine.html"/>
   <updated>2014-03-06T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2014/03/06/god-help-ukraine</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;I wanted to use this blog only for programming related posts. However the things I need to say are too important to be kept away.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;how-i-feel-and-what-i-do&quot;&gt;How I feel and what I do&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=iZRktdWljmc&quot;&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/unarmed-ua-military-march.jpg&quot; title=&quot;Unarmed Ukrainian soldiers against shooting Russian Special Forces&quot; /&gt;&lt;/a&gt;
The &lt;a href=&quot;http://en.wikipedia.org/wiki/2014_Crimean_crisis&quot;&gt;situation in Ukraine&lt;/a&gt; threatens the safety of my country and even my family.&lt;/p&gt;

&lt;p&gt;I now check the news about Ukraine multiple times per day. I get them in Ukrainian, English and Russian. I can understand some Polish and a few words in German and French.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/protest-2014-03-03.jpg&quot; title=&quot;At a protest near the Russian embassy in Vilnius on Sunday&quot; /&gt;
I feel for Ukrainian people of all nationalities. They have just had a &lt;a href=&quot;http://en.wikipedia.org/wiki/2014_Ukrainian_revolution&quot;&gt;bloody revolution&lt;/a&gt;. While they were mourning their dead, they have been back-stabbed by their closest “brothers”. I think this shows the basic treacherousness and lack of humanity from the aggressors.&lt;/p&gt;

&lt;p&gt;I actively support the desire of Ukrainian people to &lt;strong&gt;decide their own fate and future&lt;/strong&gt;. I am very impressed by their courage and strength to defend themselves using peaceful means. Esp. the Ukrainian military in Crimea – they do have honor and balls.&lt;/p&gt;

&lt;p&gt;The least I can do to help them is go to protests and support for Ukraine actions, which now happen in Vilnius every day.&lt;/p&gt;

&lt;h3 id=&quot;the-situation&quot;&gt;The situation&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.stopfake.org/en/unknown-armed-individuals-in-sevastopol-turned-out-to-be-russian-special-forces/&quot;&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/ru-military-crimea.jpg&quot; alt=&quot;Russian Special Forces in Crimea&quot; /&gt;&lt;/a&gt;
Russian military has invaded part of Ukraine. This is a fact. Only the Russian authorities deny it. They are lying. I have seen enough eye-witness videos from Crimea myself to believe that. Never mind the reaction of the whole (minus 1 country) UN security council meeting (which I watched live).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/International_reaction_to_the_2014_Crimean_crisis&quot;&gt;&lt;img class=&quot;quarter&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Crimea_reaction_clean.png/800px-Crimea_reaction_clean.png&quot; title=&quot;International reactions to the 2014 Crimean crisis&quot; /&gt;&lt;/a&gt;
I see that &lt;a href=&quot;http://en.wikipedia.org/wiki/International_reaction_to_the_2014_Crimean_crisis&quot;&gt;no other country supports&lt;/a&gt; invasion into Ukraine by Russia (not even &lt;a href=&quot;http://en.wikipedia.org/wiki/Belarus&quot;&gt;Belarus&lt;/a&gt; or &lt;a href=&quot;http://en.wikipedia.org/wiki/Kazakhstan&quot;&gt;Kazakhstan&lt;/a&gt; – it’s closest authoritarian allies). This gives me hope that the aggression can be stopped.&lt;/p&gt;

&lt;p&gt;I am no military expert, but I don’t think Russia has the resources to win any large-scale war. It has invested quite a lot into its armed forces, but it doesn’t seem like it could find any allies for going to war at the moment. The choice of Ukraine as its victim may be one of the reasons.&lt;/p&gt;

&lt;h3 id=&quot;risks-to-lithuania-and-its-civilians&quot;&gt;Risks to Lithuania and its civilians&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Lithuania&quot;&gt;&lt;img class=&quot;third&quot; src=&quot;/static/2014/lithuania-on-map.png&quot; alt=&quot;Lithuania&quot; /&gt;&lt;/a&gt;
However there is a substantial threat to my country (&lt;a href=&quot;http://en.wikipedia.org/wiki/Lithuania&quot;&gt;Lithuania&lt;/a&gt;). The lunacy of the Russian authorities is &lt;a href=&quot;http://news.bbc.co.uk/2/hi/europe/4480745.stm&quot;&gt;grounded&lt;/a&gt; on &lt;a href=&quot;http://en.wikipedia.org/wiki/Revanchism&quot;&gt;revanchism&lt;/a&gt; and hate towards nations who escaped their control. This revanchism is felt by &lt;strong&gt;a lot&lt;/strong&gt; (definitely not all&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;) of Russians. If this lunacy continues, because of the revanchism (and judging by polls of Russian citizens&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;), we (Lithuanians, Latvians, Estonians) could be next. &lt;a href=&quot;http://en.wikipedia.org/wiki/Georgia_%28country%29&quot;&gt;Georgia&lt;/a&gt; may be easier to invade (since it is not a NATO country), but the polls show that the “Balts” may be hated even more&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/protest-2014-03-02-ap.jpg&quot; alt=&quot;my kids at a protest&quot; /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Lithuania&quot;&gt;&lt;strong&gt;Lithuania&lt;/strong&gt;&lt;/a&gt; is a small country (56,300 km² – only 2.5x larger than Crimea). We could be invaded quite fast. Our military is too weak to hold the borders of our country from a Russian attack. There could be a time of some chaos and harm done to civilians until the help comes. I have two small kids. Go figure… I am evaluating my options at the moment.&lt;/p&gt;

&lt;h3 id=&quot;reactions-east-and-west&quot;&gt;Reactions East and West&lt;/h3&gt;

&lt;p&gt;It does not seem [here in Eastern Europe] that the Western leaders and the media are fully ready for the &lt;strong&gt;two-facedness&lt;/strong&gt; of Russian authorities. It is clear that Russian authorities and diplomats were successfully &lt;strong&gt;playing them&lt;/strong&gt; by &lt;a href=&quot;http://www.stopfake.org/en/&quot;&gt;spreading lies&lt;/a&gt;, loud claims and confusion – stopping the opponent from taking action while their troops were invading Crimea. The lies from the Russian authorities and some confusion on the part of Western politicians continues. We don’t know if the lies will be used to “cover” some other military action.&lt;/p&gt;

&lt;p&gt;I am disgusted by some of the politicians (including in my country) putting business interests above the basic human right of 45 million people in Europe to decide their fate themselves and above the safety of many more.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/save-russians-from-putin.jpg&quot; title=&quot;It says: I am russian. Save me. Recall Putin's troops. / The tri-colored heart is in Armenian flag colours.&quot; /&gt;
However I am optimistic about the people in Ukraine and Eastern Europe in the long term: we found we need unity not only because of the shared view of our painful histories, but also for our futures. The &lt;a href=&quot;http://www.telegraph.co.uk/news/worldnews/europe/ukraine/10677080/Ukraine-crisis-Ukrainians-rush-to-join-military.html&quot;&gt;blossoming unity&lt;/a&gt; of people of all nationalities in Ukraine (Ukrainians, Russians, &lt;a href=&quot;http://www.reuters.com/article/2014/03/02/us-ukraine-crisis-tatars-idUSBREA210VI20140302&quot;&gt;Tatars&lt;/a&gt;, &lt;a href=&quot;http://www.timesofisrael.com/ukraine-jews-appeal-to-russia-to-stop-aggression/&quot;&gt;Jews&lt;/a&gt;, others) in response of the Russian threat is the brightest example of that.&lt;/p&gt;

&lt;h3 id=&quot;to-anyone-who-reads-this&quot;&gt;To anyone who reads this:&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://www.google.com/search?q=support+ukraine&amp;amp;tbm=isch&quot;&gt;&lt;img class=&quot;quarter&quot; src=&quot;/static/2014/support-ukraine.jpg&quot; alt=&quot;Support Ukraine&quot; /&gt;&lt;/a&gt;
Ukrainian people need your help very much. Every little thing helps. Talk to your representatives, media, show your support. At least put a &lt;a href=&quot;https://www.google.com/search?q=support+ukraine&amp;amp;tbm=isch&quot;&gt;blue-yellow ribbon&lt;/a&gt; somewhere on your facebook, twitter or blog.&lt;/p&gt;

&lt;p&gt;Don’t get distracted by the theories on the inner workings of Putin’s brain, leaked phone calls or any other misdirecting information thrown your way.&lt;/p&gt;

&lt;p&gt;There is &lt;strong&gt;one&lt;/strong&gt; basic but very important thing Ukrainian people need at the moment – to freely elect their new president. They have &lt;a href=&quot;https://en.wikipedia.org/wiki/Ukrainian_presidential_election,_2014&quot;&gt;&lt;strong&gt;elections planned for May 25th&lt;/strong&gt;&lt;/a&gt;. The elections cannot be fully free and represent all the Ukrainian people with Russian soldiers occupying part of the country. Therefore &lt;strong&gt;Russian military has to go&lt;/strong&gt; home and fast.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can reprint or share this text without limitations&lt;sup id=&quot;fnref:4&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Update: &lt;strong&gt;There is a &lt;a href=&quot;http://www.reddit.com/r/europe/comments/1zoj1d/what_the_situation_in_ukraine_means_for_me_in/&quot;&gt;discussion at r/europe&lt;/a&gt; about this post.&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;I have huge respect for all the Russians and Belarusians who came out to support &lt;em&gt;peace&lt;/em&gt; in Ukraine and were arrested for that in Moscow, Minsk, St. Petersburg, elsewhere. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;http://www.ibtimes.com/who-are-russias-allies-enemies-heres-how-russians-view-other-countries-infographic-1409150&quot;&gt;June 2013 data&lt;/a&gt;. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
      &lt;p&gt;A &lt;a href=&quot;https://www.facebook.com/photo.php?fbid=829408240418617&amp;amp;set=a.242722719087175.81421.100000483476379&amp;amp;type=1&quot;&gt;leak on Facebook of recent poll data&lt;/a&gt;: 52% of Russian citizens would go themselves or &lt;em&gt;send their children&lt;/em&gt; to war with Ukraine. Baltic states top the list for “What other countries Russian military should invade to support Russian interests?”. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
      &lt;p&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/4.0/&quot;&gt;&lt;img alt=&quot;Creative Commons License&quot; style=&quot;border-width:0&quot; src=&quot;http://i.creativecommons.org/l/by/4.0/88x31.png&quot; /&gt;&lt;/a&gt;&lt;span xmlns:dct=&quot;http://purl.org/dc/terms/&quot; href=&quot;http://purl.org/dc/dcmitype/Text&quot; property=&quot;dct:title&quot; rel=&quot;dct:type&quot;&gt;&lt;em&gt;What the situation in Ukraine means for me in Lithuania&lt;/em&gt;&lt;/span&gt; by &lt;a xmlns:cc=&quot;http://creativecommons.org/ns#&quot; href=&quot;http://emilis.github.io/2014/03/06/god-help-ukraine.html&quot; property=&quot;cc:attributionName&quot; rel=&quot;cc:attributionURL&quot;&gt;Emilis Dambauskas&lt;/a&gt; is licensed under a &lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/4.0/&quot;&gt;Creative Commons Attribution 4.0 International License&lt;/a&gt;. &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Firefox OS presentation at VilniusJS meetup</title>
   <link href="http://emilis.github.io/javascript/firefox%20os/2013/06/19/firefox-os-at-vilniusjs.html"/>
   <updated>2013-06-19T00:00:00+00:00</updated>
   <id>http://emilis.github.com//javascript/firefox%20os/2013/06/19/firefox-os-at-vilniusjs</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/files/firefoxos-standard-alt.png&quot; alt=&quot;Firefox OS&quot; class=&quot;right&quot; /&gt;
I will be making a presentation about &lt;a href=&quot;https://www.mozilla.org/en-US/firefox/partners/#os&quot;&gt;Firefox OS&lt;/a&gt; and my experience developing &lt;a href=&quot;https://github.com/emilis/worldradioplayer&quot;&gt;my app&lt;/a&gt; on it for a &lt;a href=&quot;http://vilniusjs.lt/&quot;&gt;local JavaScript developer community&lt;/a&gt; in Vilnius, Lithuania on June 25th, 2013.&lt;/p&gt;

&lt;p&gt;If you will be nearby, I invite you to visit ( &lt;a href=&quot;https://tito.io/vilniusjs/vilniusjs-6&quot;&gt;register here&lt;/a&gt; ). There is usually free beer afterwards ;-).&lt;/p&gt;

&lt;p&gt;I will try to summarize my experience building &lt;a href=&quot;https://github.com/emilis/worldradioplayer&quot;&gt;the app&lt;/a&gt; in a post on this blog before the presentation.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Dear Mozilla, stop watching me...</title>
   <link href="http://emilis.github.io/privacy/2013/06/16/mozilla-stop-watching-me.html"/>
   <updated>2013-06-16T00:00:00+00:00</updated>
   <id>http://emilis.github.com//privacy/2013/06/16/mozilla-stop-watching-me</id>
   <content type="html">&lt;p&gt;I have signed the &lt;a href=&quot;https://optin.stopwatching.us/&quot;&gt;StopWatching.Us&lt;/a&gt; letter today. I am not a US citizen, so even if the letter succeeds, I don’t think my privacy will improve substantially. But at least I did something.&lt;/p&gt;

&lt;p&gt;I am not sure what could solve the current privacy crisis and return our rights back. I think that lobbyism is only part of a possible successful solution, because a big part of the problem is a very technological one.&lt;/p&gt;

&lt;p&gt;Consider piracy. It is a complex problem, but part of it is that copying and transferring copyrighted data is so cheap, easy and fast nowadays. You can’t put that genie back in the bottle.  Similarly copying and transfering our private data is also getting cheaper, easier and faster every day.&lt;/p&gt;

&lt;p&gt;I don’t think that my private data will end up exclusively at the NSA. Some of it may have already reached UK or Australia, most of it will probably end up everywhere eventually. Because leaking, selling or stealing it is also getting cheaper, easier and faster. There are some &lt;em&gt;regimes&lt;/em&gt; close to my nations borders that I am much more worried about than USA, UK or Australia.&lt;/p&gt;

&lt;p&gt;I think &lt;strong&gt;gathering&lt;/strong&gt; data is a big part of the privacy problem that may be solved or improved. I try to avoid exposing my own private data as much as I can. I avoid Facebook and Google, personalized discount cards, stick to &lt;a href=&quot;https://www.fsf.org/about/what-is-free-software&quot;&gt;free software&lt;/a&gt;, etc.. I am always looking into what else I could do.&lt;/p&gt;

&lt;p&gt;I also think privacy conscious organizations (like the &lt;a href=&quot;https://mozilla.org/&quot;&gt;Mozilla Foundation&lt;/a&gt;) should lead others by avoiding to gather information about me.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Update 2013-06-17 10:16 EET:&amp;lt;/em&amp;gt; My intent is not to point fingers at Mozilla for what they do, but for all of us to take a moment to re-asses what we are doing with our user data. I am guilty of such practices myself. Until recently I used Google Analytics on this blog.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But I received this message &lt;strike&gt;today&lt;/strike&gt; &lt;strong&gt;a couple of days ago&lt;/strong&gt; from Mozilla, full of tracking links and images. See for yourself:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Date: Fri, 14 Jun 2013 17:28:38 +0000
...
From: &quot;Mark Surman, Mozilla.org&quot; &amp;lt;joinmozilla@mozilla.org&amp;gt;
Subject: Stop watching us
Message-ID: &amp;lt;f121f5a56caa2c184daabf2169a65b46@bounce.bluestatedigital.com&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The personalized links are in the HTML part of the message. It is funny that Thunderbird displays the full personalized link in the statusbar, even though they tried to disguise it with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;title=&quot;...&quot;&lt;/code&gt; attribute:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;a href=3D&quot;https://sendto.mozilla.org/page/m=
/29b5e3cb/6a8d42ca/163f6d38/5cda3f54/3611907196/VEsH/&quot; style=3D&quot;color: =
#ec3e36; font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; =
font-size: 13px; line-height: 1.5; font-weight: bold;&quot; =
title=3D&quot;https://sendto.mozilla.org/Stop-Watching-Us-1&quot;&amp;gt;&amp;lt;span =
style=3D&quot;color: #ec3e36;&quot;&amp;gt;Stop watching us.&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;More personalized links:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;a href=3D&quot;https://sendto.mozilla.org/page/m/29b5e3cb/6=
a8d42ca/163f6d38/5cda3f54/3611907196/VEsE/&quot; style=3D&quot;color: #ec3e36; =
font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; =
font-size: 13px; line-height: 1.5; font-weight: bold;&quot; =
title=3D&quot;https://sendto.mozilla.org/Stop-Watching-Us-1&quot;&amp;gt;&amp;lt;span =
style=3D&quot;color: #ec3e36;&quot;&amp;gt;Please, I urge you to join me and so many others =
in telling the US government: stop watching us. =
&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;
...
&amp;lt;a href=3D&quot;https://sendto.mozilla.org/page/m/2=
9b5e3cb/6a8d42ca/163f6d38/5cda3f54/3611907196/VEsF/&quot; style=3D&quot;color: =
#ec3e36; font-family: Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; =
font-size: 13px; line-height: 1.5; font-weight: bold;&quot; =
title=3D&quot;https://sendto.mozilla.org/Stop-Watching-Us-1&quot;&amp;gt;&amp;lt;span =
style=3D&quot;color: #ec3e36;&quot;&amp;gt;StopWatching.Us&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;
...
&amp;lt;a href=3D&quot;https://sendto.mozilla.org/page/m/29b5e3cb/6a8d42ca=
/163f6d38/5cda3f57/3611907196/VEsC/&quot; style=3D&quot;color: #ec3e36; font-family: =
Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; font-size: 13px; =
line-height: 1.5; font-weight: bold;&quot; =
title=3D&quot;https://sendto.mozilla.org/stopwatchingus-1&quot;&amp;gt;&amp;lt;span =
style=3D&quot;color: #ec3e36;&quot;&amp;gt;Please donate $5 or more today to fund this and =
other efforts to protect the Web and users' privacy and =
security.&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Tracking image?:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;img src=3D&quot;https://sendto.mozilla.org/page/o/29b5e3cb=
/6a8d42ca/163f6d38/5cda3f28/3611907196/open.gif&quot; width=3D&quot;1&quot; =
height=3D&quot;1&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I am sure there are good reasons for tracking how many of the recipients read the message or which link they clicked. But knowing that this data of your users will be easy to get and use by third parties for something that may be contrary to your user interests – would you still do it?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Left Right Left... Vim Shell Vim...</title>
   <link href="http://emilis.github.io/bash/vim/2012/03/06/left-right-left-vim-shell-vim.html"/>
   <updated>2012-03-06T00:00:00+00:00</updated>
   <id>http://emilis.github.com//bash/vim/2012/03/06/left-right-left-vim-shell-vim</id>
   <content type="html">&lt;p&gt;I added a couple of configuration lines and can now switch between Vim and a child shell session with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Alt+Left/Right&lt;/code&gt;. Like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;+-----+                 +-------+
| Vim | -- Alt+Right -&amp;gt; | shell |
|     |                 |       |
|     | &amp;lt;- Alt+Left --- |       | 
+-----+                 +-------+
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It feels like a faster way for switching between file editing and project tasks via shell and helped me reduce the number of tabs I keep in GNOME Terminal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; changes:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;map &amp;lt;A-Right&amp;gt; :sh&amp;lt;CR&amp;gt;
map &amp;lt;A-Left&amp;gt; :q&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.inputrc&lt;/code&gt; changes:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext break highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$if term=xterm
    &quot;\e[1;3D&quot;:  &quot;\C-d&quot;
$endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Warning: this makes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Alt+Left&lt;/code&gt; work like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+D&lt;/code&gt; (exit) in &lt;em&gt;all&lt;/em&gt; of your shells.&lt;/p&gt;

&lt;p&gt;The one drawback is that when I return to a tab and see a shell window I am not sure if the shell was opened from Vim, or Vim was closed. A visual clue would be nice, but I am not sure yet how to add it.&lt;/p&gt;

&lt;h2 id=&quot;back-story&quot;&gt;Back story:&lt;/h2&gt;

&lt;p&gt;I usually keep 2-3 terminal tabs open for each code repository I work with (Vim, shell, server processes, etc.). Sometimes I may have ~10 tabs in my GNOME Terminal and am quite used to quickly switching between them.&lt;/p&gt;

&lt;p&gt;However last week I was constantly committing changes to two repositories simultaneously and I had to do this more than often. I noticed that I am spending too much brain cycles for tracking which tab I’m on at the moment and how to get to the tab that I need.&lt;/p&gt;

&lt;p&gt;I was writing some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make&lt;/code&gt; tasks to reduce the number of commands I have to use to deploy my code, restart servers, etc. I had an idea of how I could gather all my interactions with a repository under one terminal tab. The couple of key bindings did the trick.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Prepackaged Solr with Lithuanian Language Support</title>
   <link href="http://emilis.github.io/2011/09/12/solr-lt.html"/>
   <updated>2011-09-12T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2011/09/12/solr-lt</id>
   <content type="html">&lt;p&gt;I have packaged a compiled version of &lt;a href=&quot;http://lucene.apache.org/solr/&quot;&gt;Apache Solr&lt;/a&gt; with &lt;a href=&quot;https://github.com/zmedelis/ltlangpack&quot;&gt;Lithuanian language support&lt;/a&gt; developed by Žygimantas Medelis, M. Petkevičius and Tomas Krilavičius.&lt;/p&gt;

&lt;p&gt;I have also added some documentation for novice users.&lt;/p&gt;

&lt;p&gt;So if you need to search through lots of Lithuanian text, grab a copy from GitHub: &lt;a href=&quot;https://github.com/emilis/solr-lt&quot;&gt;emilis/solr-lt&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>One Little Customization to One Mans Bash Prompt...</title>
   <link href="http://emilis.github.io/2011/09/12/customized-bash-prompt.html"/>
   <updated>2011-09-12T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2011/09/12/customized-bash-prompt</id>
   <content type="html">&lt;p&gt;I see there have been a number Bash tips posts on &lt;a href=&quot;http://news.ycombinator.com/news&quot;&gt;Hacker News&lt;/a&gt; recently.&lt;/p&gt;
&lt;p&gt;Let me share an improvement for the shell I made myself only lately.&lt;/p&gt;

&lt;h3&gt;Grand Design&lt;/h3&gt;

&lt;p&gt;First a little explanation: I have a vision of how I would like my terminal application to look like:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/projects/terminal.html&quot;&gt;&lt;img src=&quot;/projects/terminal/design.png&quot; alt=&quot;Grand Terminal design&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This design would work very well with the overall UI configuration on my Ubuntu box (I have panel and taskbar on the left, use &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/tree-style-tab/&quot;&gt;Tree Style Tab&lt;/a&gt; for Firefox, &lt;a href=&quot;http://zim-wiki.org/&quot;&gt;Zim desktop wiki&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;Pathetic Implementation&lt;/h3&gt;

&lt;p&gt;My problem is that I don't have the necessary time and GUI development experience to implement this myself.&lt;/p&gt;

&lt;p&gt;So a couple of weeks ago I made myself a crutch -- tweaked my Bash prompt. It now looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/projects/terminal/current.png&quot; alt=&quot;How my shell looks currently&quot;&gt;&lt;/p&gt;

&lt;p&gt;Although I didn't add much (just a separator line and bold style for command text) it took me some time to play with various colours and styles to achieve this effect.&lt;/p&gt;

&lt;h3&gt;The Code&lt;/h3&gt;

&lt;p&gt;I have put the configuration file on GitHub &lt;a href=&quot;https://github.com/emilis/emilis-config/blob/master/.bash_ps1&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I saved the file in my HOME directory and link it from &lt;a href=&quot;https://github.com/emilis/emilis-config/blob/master/.bashrc&quot;&gt;my .bashrc&lt;/a&gt; like this:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;bash&quot;&gt;if [ -n &quot;$PS1&quot; -a -f &quot;$HOME/.bash_ps1&quot; ]; then
    . &quot;$HOME/.bash_ps1&quot;
fi
&lt;/code&gt;&lt;/pre&gt;
                        
&lt;h3&gt;Words of wisdom&lt;/h3&gt;

&lt;p&gt;I bet some of you will now go and play with your Bash prompt configuration. Let me offer you a comment by some unnamed Ubuntu/Debian maintainer wizards I found while playing with my .bashrc:&lt;/p&gt;

&lt;blockquote&gt;# uncomment for a colored prompt, if the terminal has the capability;&lt;br&gt;
# turned off by default to not distract the user: &lt;strong&gt;the focus in a terminal window should be on the output of commands, not on the prompt&lt;/strong&gt;&lt;br&gt;
# force_color_prompt=yes
&lt;/blockquote&gt;

                    

</content>
 </entry>
 
 <entry>
   <title>Notes from discussion on "Usefulness of inventing programming languages"</title>
   <link href="http://emilis.github.io/2011/04/27/notes-from-discussions-about-humble.html"/>
   <updated>2011-04-27T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2011/04/27/notes-from-discussions-about-humble</id>
   <content type="html">&lt;p&gt;Yesterday I submitted a link to my &lt;a href=&quot;/2011/04/12/usefullnes-of-inventing-languages.html&quot;&gt;previous post&lt;/a&gt; to &lt;a href=&quot;http://news.ycombinator.com/&quot;&gt;HackerNews&lt;/a&gt; and someone was kind enough to submit it to &lt;a href=&quot;http://reddit.com/&quot;&gt;Reddit's&lt;/a&gt; &lt;a href=&quot;http://reddit.com/r/programming/&quot;&gt;/r/programming&lt;/a&gt; and other developer forums all over the web.&lt;/p&gt;

&lt;p&gt;I was happy to see the interest of the hacker/programmer community in &lt;a href=&quot;/projects/humble.html&quot;&gt;Humble&lt;/a&gt;. Many people found it interesting or inspiring. I also received some well articulated criticism, suggestions and links.&lt;/p&gt;

&lt;p&gt;I don't know how much time I will be able to spend improving Humble (if any). So, for future reference, I want to document some of the links and notes that people provided in comments on this blog, HN, Reddit and elsewhere.&lt;/p&gt;

&lt;h3&gt;Programming languages/environments:&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.subtextual.org/&quot;&gt;Subtext&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Intentional_programming&quot;&gt;Intentional programming&lt;/a&gt; (a concept developed by &lt;a href=&quot;http://en.wikipedia.org/wiki/Charles_Simonyi&quot;&gt;Charles Simonyi's&lt;/a&gt; post-Microsoft &lt;a href=&quot;http://intentsoft.com/technology/overview.html&quot;&gt;company&lt;/a&gt;). &lt;a href=&quot;http://www.youtube.com/watch?v=tSnnfUj1XCQ&quot;&gt;Video here&lt;/a&gt;.&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.dwheeler.com/readable/sweet-expressions.html&quot;&gt;Sweet expressions&lt;/a&gt;: a suite of readable formats for Lisp-like languages.&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://byob.berkeley.edu/&quot;&gt;Build Your Own Blocks&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.mathedpage.org/t-and-m/turtle-and-mouse.html&quot;&gt;Boxer&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;Esoteric languages:&lt;ul&gt;
        &lt;li&gt;&lt;a href=&quot;http://www.bigzaphod.org/cow/&quot;&gt;Cow&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;http://www.muppetlabs.com/%7Ebreadbox/orth/&quot;&gt;Orthogonal&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;[Outline] editors:&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;http://workflowy.com/&quot;&gt;WorkFlowy&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://zetabee.com/&quot;&gt;ZetaBee&lt;/a&gt; (also a &lt;a href=&quot;https://zetabee.com/text/share?n=1280277669&amp;amp;h=MU54djV5VFRGVkE2YjZhbXlkQ2tsZz09&quot;&gt;code example&lt;/a&gt; submitted by chime@reddit).&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://hnb.sourceforge.net/&quot;&gt;Hierarchical notebook(hnb)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Notes&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;p&gt;The idea of using a table to represent a function implementation was obviously proposed before me by &lt;a href=&quot;http://en.wikipedia.org/wiki/David_Parnas&quot;&gt;David Parnas&lt;/a&gt;, but in the context of software documentation.&lt;/p&gt;&lt;ul&gt;
        &lt;li&gt;A recent publication on this: &lt;a href=&quot;http://dx.doi.org/10.1016/j.knosys.2008.11.001&quot; title=&quot;http://dx.doi.org/10.1016/j.knosys.2008.11.001&quot;&gt;Parnas D., Document based rational software development, Journal of Knowledge-Based Systems, 22(3):132-141, 2009.&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;http://www.informatik.uni-trier.de/%7Eley/db/indices/a-tree/p/Parnas:David_Lorge.html&quot; title=&quot;http://www.informatik.uni-trier.de/~ley/db/indices/a-tree/p/Parnas:David_Lorge.html&quot;&gt;More publications by D. Parnas&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;A few people agreed that we lack tools to program on tablets and other touch-controlled devices. I hope someone will start thinking about this.&lt;/p&gt;&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;The concept of separating code structure from its presentation seems to have potential. Although it may be hard to achieve this in Humble since the introduction of tables.&lt;/p&gt;&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;Some people had traumatic experiences with using &lt;em&gt;relational&lt;/em&gt; tables to write code (&lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Installer&quot;&gt;MSI installers&lt;/a&gt;).&lt;/p&gt;&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;It seems I had errors in 99bottles and even FizzBuzz code :-)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Links to full discussions:&lt;/h3&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;http://news.ycombinator.com/item?id=2484285&quot;&gt;Hacker News&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.reddit.com/r/programming/comments/gxpup/usefulness_of_inventing_programming_languages/&quot;&gt;Reddit&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://axisofeval.blogspot.com/2011/04/hypercode.html&quot;&gt;Axis of Eval&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks to everyone for your comments!&lt;/p&gt;

&lt;p&gt;&lt;i&gt;P.S. &lt;a href=&quot;http://intensedebate.com/&quot;&gt;IntenseDebate&lt;/a&gt; disabled comments on my previous post. Probably due to traffic. The comments are not lost and I hope IntenseDebate will restore them in the future.&lt;/i&gt;&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Usefulness of inventing programming languages</title>
   <link href="http://emilis.github.io/2011/04/12/usefullnes-of-inventing-languages.html"/>
   <updated>2011-04-12T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2011/04/12/usefullnes-of-inventing-languages</id>
   <content type="html">&lt;p&gt;I have a hobby project: Humble programming language.&lt;/p&gt;
&lt;p&gt;It started as a joke: a Lisp with bullet-lists instead of parenthesis. Later I added every feature I found useful or interesting from other programming languages.&lt;/p&gt;
&lt;p&gt;I use it as some form  of &lt;a href=&quot;http://en.wikipedia.org/wiki/Pseudocode&quot;&gt;pseudocode&lt;/a&gt; to write code for complex problems I stumble upon. I wrote a translator (to PHP) for it a couple of years ago (thought of using it as an embedded language in a CMS). Nowadays I mostly play with its syntax and don't worry about the implementation.&lt;/p&gt;

&lt;p&gt;Humble code looks like this:&lt;/p&gt;
&lt;pre class=&quot;humble&quot;&gt;&lt;i&gt;// Both *actions* do the same:&lt;/i&gt;&lt;ul&gt;&lt;li&gt;print Hello World&lt;/li&gt;&lt;li&gt;print:&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Hello&lt;/li&gt;&lt;li&gt;World&lt;/li&gt;&lt;/ol&gt;&lt;/ul&gt;&lt;/pre&gt;

&lt;p&gt;Recently I expanded it to include tables for expressing dictionaries, functions and variable declarations.&lt;small&gt;&lt;a id=&quot;ref1&quot; href=&quot;#note1&quot;&gt;&lt;sup&gt;*&lt;/sup&gt;&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;This is an example of how one would define a recursive implementation of a factorial in Humble:&lt;/p&gt;

&lt;pre class=&quot;humble&quot;&gt;&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;factorial&lt;/td&gt;
      &lt;td&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;[0]&lt;/td&gt;&lt;td&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;[x]&lt;/td&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;multiply:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;$ x&lt;/li&gt;&lt;li&gt;factorial (- $x 1)&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
      &lt;p&gt;&lt;i&gt;// Note the usage of &lt;a href=&quot;http://www.erlang.org/doc/reference_manual/functions.html&quot;&gt;function clauses like in Erlang&lt;/a&gt;.&lt;/i&gt;&lt;/p&gt;
&lt;/pre&gt;

&lt;h3&gt;On why the tables work so well&lt;/h3&gt;

&lt;p&gt;I use the same two-column tables to express dictionaries, functions and namespaces (or variable scope), because I think that these things are nearly equivalent in how they work and only differ in what we use them for.&lt;/p&gt;

&lt;p&gt;Here  is a &lt;a href=&quot;http://mathworld.wolfram.com/Function.html&quot;&gt;definition of a function from Wolfram MathWorld&lt;/a&gt; and my college  maths book:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;i&gt;A function is a relation that uniquely associates members 
of one set with members of another set.&lt;/i&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt; It looks to me that dictionaries or mapping variable names to their values fit into this definition.&lt;/p&gt;

&lt;p&gt;This raises some interesting questions. E.g. why this does not work: &lt;code class=&quot;javascript&quot;&gt;[1,2,3].map({2:4})&lt;/code&gt; (in JavaScript)?&lt;/p&gt;

&lt;p&gt;Questions like these came to me like some revelation (or &lt;a href=&quot;http://en.wikipedia.org/wiki/Id%C3%A9e_fixe_%28psychology%29&quot;&gt;idée fixe&lt;/a&gt;) a few weeks ago. I wondered if there is a set of operations that should work on different data types (numbers, strings, lists, dictionaries) even if you don't see them often in programming languages or they are expressed in other ways. E.g.:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;code class=&quot;javascript&quot;&gt;[2,3] + [1,4]&lt;/code&gt; gives a string &lt;code class=&quot;javascript&quot;&gt;&quot;2,31,4&quot;&lt;/code&gt; in JavaScript, but shouldn't this produce &lt;code class=&quot;javascript&quot;&gt;[2,3,1,4]&lt;/code&gt; (which is equivalent to &lt;code class=&quot;javascript&quot;&gt;Array.concat([2,3], [1,4])&lt;/code&gt; )?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;To get these questions out of my head I created myself a table of data types and operations and then could focus on my work again ;-).&lt;small&gt;&lt;a id=&quot;ref2&quot; href=&quot;#note2&quot;&gt;&lt;sup&gt;**&lt;/sup&gt;&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;This intellectual journey and reading about &lt;a href=&quot;http://www.erlang.org/doc/reference_manual/functions.html&quot;&gt;Erlang function clauses&lt;/a&gt; lead me to believe that tables are optimal for expressing functions.&lt;/p&gt;

&lt;h3&gt;Is it just a way to let off steam?&lt;/h3&gt;

&lt;p&gt;Not really. I have found Humble very useful in my work. I use it to design modules and functions which are hard for me to code straight away in the language I am working in.&lt;/p&gt;

&lt;p&gt;As soon as I added tables to Humble, I used the new syntax to write a complex JavaScript module at my work. Before that I was stuck with the module and it was hard for me to understand on how it should work.&lt;/p&gt;

&lt;p&gt;The reason this is so useful is that I reduced the friction and overhead involved in designing code as much as I could:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;p&gt;I use editors that I am very comfortable with (&lt;a href=&quot;http://zim-wiki.org/&quot;&gt;Zim desktop wiki&lt;/a&gt;, &lt;a href=&quot;http://www.rochesterschools.com/web/composer/default.htm&quot;&gt;Seamonkey Composer&lt;/a&gt;).&lt;/p&gt;&lt;/li&gt;
  &lt;li&gt;&lt;p&gt;I used every trick I know to make Humble code more &lt;a href=&quot;http://www.useit.com/alertbox/9710a.html&quot;&gt;readable and understandable at a glance&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
  &lt;li&gt;&lt;p&gt;I use a minimal number of code constructs that I am familiar with and/or think they would influence my thinking in a good way.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It expands my ability to solve problems that otherwise would be beyond my reach.&lt;/p&gt;

&lt;h3&gt;More about it&lt;/h3&gt;

&lt;p&gt;If you are interested in a more comprehensive description of Humble, see the &lt;a href=&quot;http://emilis.github.com/projects/humble.html&quot;&gt;current spec&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I can't show you the last big piece of code I wrote with Humble here because I don't want to get into misunderstandings with my recent employer. I'll leave you with some code I wrote recently to see if Humble is useful in writing code for problems listed in &lt;a href=&quot;http://rosettacode.org/&quot;&gt;Rosetta Code&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Examples&lt;/h4&gt;

&lt;pre class=&quot;humble&quot;&gt;&lt;table&gt;&lt;tbody&gt;
    &lt;tr&gt;
        &lt;td&gt;99bottles&lt;/td&gt;
        &lt;td&gt;&lt;ul&gt;&lt;li&gt;map&lt;/li&gt;
                &lt;ul&gt;&lt;li&gt;sequence 99 0&lt;/li&gt;
                    &lt;li&gt;&lt;table&gt;&lt;tbody&gt;
                        &lt;tr&gt;
                            &lt;td&gt;[1]&lt;/td&gt;
                            &lt;td&gt;&lt;ul&gt;&lt;li&gt;print &quot;1 bottle of beer on the wall, 1 bottle of beer.\n Take one down and pass it around, no more bottles of beer on the wall.&quot;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;[0]&lt;/td&gt;
                            &lt;td&gt;&lt;ul&gt;&lt;li&gt;print &quot;No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.&quot;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td&gt;[n]&lt;/td&gt;
                            &lt;td&gt;&lt;ul&gt;&lt;li&gt;sprint:&lt;/li&gt;&lt;ol&gt;&lt;li&gt;&quot;%s bottles of beer on the wall, %s bottles of beer.\n Take one down and pass it around, %s bottles of beer on the wall.\n&quot;&lt;/li&gt;&lt;li&gt;$n&lt;/li&gt;&lt;li&gt;$n&lt;/li&gt;&lt;li&gt;(- $n 1)&lt;/li&gt;&lt;/ol&gt;&lt;/ul&gt;&lt;/td&gt;
                        &lt;/tr&gt;
                    &lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;
                &lt;/ul&gt;
        &lt;/ul&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;FizzBuzz&lt;/td&gt;
      &lt;td&gt;&lt;ul&gt;&lt;li&gt;map &lt;/li&gt;&lt;ul&gt;&lt;li&gt;sequence 1 100&lt;/li&gt;&lt;li&gt;&lt;table&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;td&gt;[n]&lt;/td&gt;
                  &lt;td&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td nowrap=&quot;nowrap&quot;&gt;(= 0 (% $n 15))&lt;/td&gt;
                        &lt;td&gt;                 &lt;ul&gt;&lt;li&gt;print &quot;FizzBuzz&quot;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
                      &lt;/tr&gt;
&lt;tr&gt;
                        &lt;td&gt;(= 0 (% $n 3))&lt;/td&gt;
                        &lt;td&gt;&lt;ul&gt;&lt;li&gt;print &quot;Fizz&quot;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                        &lt;td&gt;(= 0 (% $n 5))&lt;/td&gt;
                        &lt;td&gt;&lt;ul&gt;&lt;li&gt;print &quot;Buzz&quot;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                    &lt;/tbody&gt;
                  &lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;
      &lt;td&gt;sequence      &lt;/td&gt;
      &lt;td&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;[to]&lt;/td&gt;
            &lt;td&gt;&lt;ul&gt;&lt;li&gt;sequence 0 $to&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;[from, to]&lt;/td&gt;
            &lt;td&gt;&lt;ul&gt;&lt;li&gt;sequence $from $to 1&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td nowrap=&quot;nowrap&quot;&gt;[from, to, step]&lt;/td&gt;
            &lt;td&gt;&lt;ul&gt;&lt;li&gt;while:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&amp;lt; $from $to&lt;/li&gt;&lt;li&gt;do:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;yield $from &lt;i&gt;// this one generates values&lt;/i&gt;&lt;/li&gt;&lt;li&gt;set from:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;+ $from $step&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/pre&gt;


&lt;h3&gt;Notes&lt;/h3&gt;

&lt;p id=&quot;note1&quot;&gt;&lt;a href=&quot;#ref1&quot;&gt;&lt;sup&gt;*&lt;/sup&gt;&lt;/a&gt;
 Previously I used &lt;a href=&quot;http://zim-wiki.org/&quot;&gt;Zim desktop wiki&lt;/a&gt; to write my Humble code. Zim does 
not support tables, so I was just writing bullet-lists. But then I 
started using &lt;a href=&quot;http://www.rochesterschools.com/web/composer/default.htm&quot;&gt;Seamonkey Composer&lt;/a&gt; for that and was able to write the tables
 and to create myself a CSS file to make the code more beautiful.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;It
 is interesting to note (and very visible in this case) how the choice 
of an editor influences what you can and cannot do with your code.&lt;/p&gt;
  &lt;p&gt;I am once more amazed that the editor I used to create my first web &lt;em&gt;pages&lt;/em&gt; 14 years ago is still the most convenient for some jobs today.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p id=&quot;note2&quot;&gt;&lt;a href=&quot;#ref2&quot;&gt;&lt;sup&gt;**&lt;/sup&gt;&lt;/a&gt; If you are very curious, you can see the table in a raw form, without any explanations &lt;a href=&quot;/projects/humble/types-operations.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>JavaScript is an amazing language</title>
   <link href="http://emilis.github.io/2011/02/10/javascript-is-an-amazing-language.html"/>
   <updated>2011-02-10T00:00:00+00:00</updated>
   <id>http://emilis.github.com//2011/02/10/javascript-is-an-amazing-language</id>
   <content type="html">&lt;p&gt;When I changed jobs recently I bet on working as a JavaScript developer.&lt;/p&gt;

&lt;p&gt;Part of my reasoning was that JavaScript is such a dynamic language that no matter what enterpricey or badly designed systems I will encounter, I will be able to program my way out of the mess and restore my sanity :-)&lt;/p&gt;

&lt;p&gt;Today it seems to me that I must have been right.&lt;/p&gt;

&lt;p&gt;On my new project I have to use a mix of &lt;a href=&quot;http://www.dojotoolkit.org/&quot;&gt;Dojo&lt;/a&gt;, &lt;a href=&quot;http://www.sencha.com/products/extjs/&quot;&gt;ExtJS&lt;/a&gt; and &lt;a href=&quot;http://help.arcgis.com/en/webapi/javascript/arcgis/&quot;&gt;ArcGIS&lt;/a&gt; libraries.&lt;/p&gt;

&lt;p&gt;I am not very impressed by ExtJS. It is too bloated for my tastes. I also think that Dojo and ExtJS documentation are partially to blame for the fact that I found my colleagues' code littered with object literals nesting 16+ levels deep. Because that's what you get if you start from code examples in documentation (e.g. &lt;small&gt;&lt;a href=&quot;http://dojotoolkit.org/reference-guide/dojo/declare.html&quot;&gt;dojo.declare&lt;/a&gt;, &lt;a href=&quot;http://dev.sencha.com/deploy/dev/docs/?class=Ext.Container&quot;&gt;Ext.Container&lt;/a&gt;&lt;/small&gt;).&lt;/p&gt;

&lt;p&gt;But with JavaScript it is fixable. That's what I did to refactor the code:&lt;/p&gt;

&lt;h3&gt;Fix #1: Self-executing anonymous functions instead of object literals&lt;/h3&gt;

&lt;p&gt;Lets say we have this module definition in code:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;dojo.declare(&quot;MyModule&quot;, [], {
    method1: function(params) {
        // some code
    },
    
    method2: function(params) {
        // some code
    }
});&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Looks nice until the methods grow in depth with UI element definitions, event handlers, etc.. Then you have a mess.&lt;/p&gt;

&lt;p&gt;So I changed it to this:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;dojo.declare(&quot;MyModule&quot;, [], (function() {
    
// I chose &quot;exports&quot; for similarity to CommonJS:
var exports = {};
    
exports.method1 = function(params) {
    // some code
};
    
exports.method2 = function(params) {
    // some code
};
    
// Bonus: private static vars.
var internalVar;
    
// Bonus: private static functions.
function internalFunction() {
    // some code
}
    
return exports;
    
})() // This calls the function we just created
     // and returns its result (exports object).
); // closing dojo.declare()&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Seems longer but it is better structured, reduces deep nesting and lets you hide some variables and functions inside the module.&lt;/p&gt;


&lt;h3&gt;Fix #2: &lt;em&gt;that = this&lt;/em&gt; and closures&lt;/h3&gt;

&lt;p&gt;Dojo includes a nice mechanism for injecting scope into functions: &lt;a href=&quot;http://dojotoolkit.org/reference-guide/dojo/hitch.html&quot;&gt;dojo.hitch()&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However I found this abused in our code. So I remembered the good old trick and used it instead:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;exports.someMethod = function() {
    
    var that = this;
    ...
    
    var someEventHandler = function() {
        
        // We need to go deeper:
        var anotherEventHandler = function() {
            
            that.callSomeOtherMethod();
            // At this level it saved me
            //  2 calls to dojo.hitch().
        }
    }
    ...
    
}&lt;/code&gt;&lt;/pre&gt;


&lt;h3&gt;Fix #3: you can use functions before you define them (duh)&lt;/h3&gt;

&lt;p&gt;I needed to write code for a widget. The code involved Model definition (&lt;a href=&quot;http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.JsonStore&quot;&gt;Ext.data.JsonStore&lt;/a&gt;), View definition (&lt;a href=&quot;http://dev.sencha.com/deploy/dev/docs/?class=Ext.XTemplate&quot;&gt;Ext.XTemplate&lt;/a&gt;) and widget definition:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;exports.createMyWidget = function() {
    
    // Model (not shown)
    // View (not shown)
    
    // Widget mixed with event handlers:
    return Ext.Container({
        ...
        listeners: {
            click: function() {
                // lots of event handling here
            }
        }
    });
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &quot;click&quot; and other event handlers looked too heavy compared to other code, so I decided to move them into separate functions. And I did. To preserve code reading flow I moved them below the return statement:&lt;/p&gt;

&lt;pre class=&quot;break&quot;&gt;&lt;code class=&quot;javascript&quot;&gt;exports.createMyWidget = function() {
        
    // Model (not shown)
    // View (not shown)
    
    // Widget:
    return Ext.Container({
        ...
        listeners: {
            click: onClick // defined below
        }
    });
    
    // Event handlers:
    function onClick() {
        // lots of event handling here
    }
}&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Seems like a trivial thing, but very nice. Now I feel more confident about managing complexity in my work.&lt;/p&gt;
</content>
 </entry>
 
 
</feed>
