LESS cycles

August 19th, 2014 | Permalink

Ok, LESS CSS rocks. I mean, I really-really love it. Tho, LESS does not have loops, unlike SASS.

But that is, actually, not a big concern, since with less the function can call itself. And using it and LESS’s ability to pass LESS code as a parameter, an ability of mixin to call itself and it’s so-called “guard” we can actually create a mixin for a loop, using recursion (More LESS)

Dealing with touchscreen devices

March 22nd, 2014 | Permalink

Sometimes the website has elements which are not meant to be used with touch devices. Imagine we need to hide such elements. Ok, so there are numerous ways and recommendations to do so. One of which was using modernizr, for example, which is an awesome tool to check capabilities of the browser or, the another great thing, the 51degrees. There’s no big deal after all, but 5 lines of code is always better than 15kb of code…

(more…)

Leading symbols (getting indent)

December 30th, 2013 | Permalink

Ok, so I needed to count a number of leading tabs. So I wrote this cute function which counts the number of leading symbols:

function callb($r){return intval(strlen($r[0])-strlen($r[1]));}
function getIndent($str){
    $r=preg_replace_callback('/\t+(.*)/','callb',$str);
    return $r==$str?0:$r;
}

Looks like it works without cycles. But.. To be honest this one should work way faster:

function getIndent($str){
    $number=0;
    while(substr($str,$number,1)=="\t")$number++;
    return $number;
}

But we love to look cool with our cool code, dont’t we?

Curiosity

December 17th, 2013 | Permalink

Sometimes I am getting curious with PHP. In such moments I reinvent wheels and create weird things. This thing is one of those weird things (more…)

CSS: Playing with backgrounds.

August 2nd, 2013 | Permalink
Blueprint grid

Today I’ve learnt how to use gradients to make impressive stuff using them. And made this blueprint grid pattern.

Btw, this thing over text is a div with css3 background. It has no preffixes so will work only in browsers fully supporting css3.

LESS and CSS code for this – under cut: (more…)