Blog

LESS: Whitespaces in math operations

/*
 * AFAIK:
 */
@iconsize: 200px;

.my-class{
	...
	left: (@iconsize + 100px); // Okay
	left: (@iconsize+100px); // Okay
	left: (@iconsize+ 100px); // Fail
	left: (@iconsize +100px); // Fail
	top: -@iconsize* 1.2; // Doesn't give a shit
	...
}

do fucking care your url’s letter case

Had a half-hour debug inside a WebView on android when I realized that I “mis-cased” one of my css’ name.

Related: It’s a bit strange that Node did not care about this by default (like an apache server on windows).

HTML5 localstorage ‘illegal access’ bugfix

/*
 * This will cause 'illegal access' exception 
 * on Android ~2.3 inbuilt browsers if getItem() returns 'null'
 * cuz JSON.parse can not handle null as a parameter
*/
var  a = JSON.parse(localStorage.getItem(_key));

/*
 * Possible easy solution
*/
var  a = localStorage.getItem(_key) ? JSON.parse(localStorage.getItem(_key)) : null;

Make jQuery plugins work with Zepto

Just replace the last line to match something like this:

(function($){
  $.fn.MyUselessPlugin = function (...) {
        [...]	
    return this;
  };  
})(this.jQuery || this.Zepto);

Please keep in mind that this hack will only work with plugins that use jQuery methods also implemented in Zepto.

How to extend Adobe Brackets language support based on file extension

1. Go To: Brackets\www\editor\EditorUtils.js

2. Edit the corresponding line. For example to support .JSP files:

switch (ext) {
	...
	case "jsp":
		return "htmlmixed";
	...

CoffeeScript compiler setup for WebStorm

0. Try to configure Node.js with coffe compiler parameters at “Run” > “Edit Configurations..” > “Node.js”. If you fail, move on to step 1.

1. Set up a compiler as an External Tool in Settings. Name the tool as whatever you want. In “Tool Settings” > “Parameters” add compiler parameters as you can see in fig#1. “Insert macro..” button opens a helpful window to choose between different directory parameters. If you want to compile only the opened file, choose $FilePath$. For all .coffee files in current directory choose $FileDir$. If you want to compile all .coffee files in the whole project directory select $ProjectFileDir$

cofffecompiler1 webstorm phpstorm jetbrains

2. Bind this compiler to a key that you love most or hit a random one for fun.

cofffecompiler2 webstorm phpstorm jetbrains

3. Hit F5 to compile.. Yaay!

Update: this article has been requested to be part of
the official documentation at jetbrains.com (WEB-6121)

WebStorm: Enable Zen Coding in JSP and other files

Zen Coding expand event only fires inside “HTML File Type” files. You can change this setting on each snippet (which could last a day fig#1) or you can change this “HTML File Type” definition and include a *.JSP wildcard to it fig#2.

Ongoing smartTV project w/ 8tracks API

smart tv samsung dev

More screenshots, demo video after alpha verison…

Quotes On Design Webapp [prototype preview]

Quotes On Design Webapp [prototype preview] from Zsitro (Gabor Zsoter) on Vimeo.

Just a wild guess (you won’t fool me)

// If you're a webkit => Zepto will do the trick
;(function (d) { "use strict"
var lib = "webkitBorderRadius" in document.createElement('div').style ? "zepto" : "jquery";
d.write('<script src="js/vendor/'+lib+'.min.js"><\/script>');
})(document);