Joined January 2013
·

Rafal Pastuszak

Developer · Designer · Sometimes speaks Persian in sleep. at flavours.me/rpastuszak
·
London, UK
·
·
·

@laurentroger yeah, I have, but thanks for taking the time answering me. Turned out to be an npm issue. Now everything works pretty well.

How about a sexy CoffeeScript + functional programming combo instead? :)

arr = [a, b, c, ...]

arr.each (i)-> alert i

_.each arr, (i)-> alert i

Any ideas how to test code coverage on Coffeescript projects? I've been using instanbul with karma for quite a long time but it doesn't seem they're going to add .coffee support soon.

@greelgorke Yeah, I agree in 100%, that's really, really annoying when you work in node inspector and developer tools at the same time:)

Regarding fn.bind - I don't know why I didn't think of that! That'a a lot better solution, however you have to remember that IE8 even with developer tools enabled will throw an error, since it doesn't support ES5 bind method.

That's why I prefer typing log + [TAB] in my editor and just polyfill console.log in situations it's disabled (but that's another topic, of course).

@greelgorke Well, var d = console.log won't work, because it will trigger a TypeError:)

Personally I don't mind using console.log, since, well... I use snippets. Anyway, if you want to be a little bit more elastic and pass all arguments to aliased console.log method, you could use something like that:

window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};
// source: https://github.com/h5bp/html5-boilerplate/blob/943968c7c9da05ac7bb3ae9d6127b7d70f2d9f2e/js/plugins.js

This piece of code may look familiar to those, who used previous versions of HTML5 Boilerplate. The method was removed from plugins.js some time ago.

Posted to Use reflection on yourself over 1 year ago

Someone might say it's pretentious, yet I don't think I've wasted my time by reading it:)

@greelgorke Of course! How could I forget that:D

I agree, I don't see the reason to extend Array.protype, when wrapped code can be very readable as well. Besides, using underscore methods looks really sweet, when coding in Coffeescript:

_.each items, (item)-> item.doSomeStuff()

Why would I do such thing? I can't think of any use cases here and when I think of testing, it doesn't seem to be very maintainable (but I'm sure I'm wrong somewhere). Could you give me some examples?

Posted to The Blur Method over 1 year ago

@alexanderbrevig I've just updated my app and repo location:

http://paprikka.github.io/le-bat/

Sorry for the confusion, but I'll have to use the other name for a different thing soon.

Posted to Rapid HTML with Emmet over 1 year ago

Yeah, it's pretty awesome, like almost any screencast from Jeffrey Way, I suppose:)

Posted to The Blur Method over 1 year ago

Very interesting, indeed! Basically, I'm doing the same think when creating prototypes and you've described the method so well, that I just had to create a simple web app, which could be used as a tool for it :)

Test contrast - chrome only

I you think this might be helpful, don't hesitate to include the link in your protip, so I could add a reference to your comment in my app.

Also, you can use a vanilla js version (works almost everywhere):

document.querySelectorAll('*').length

@idered That's a nice example, indeed.
I just think that the title is kinda misleading because @attributes and css properties are not created equal. And in many cases using aria-hidden would make more sense.

I think the first name of this attribute, which was irrelevant was a much better choice, since a lot of people tend to abuse it as a display:none alternative.

The question is why?

Remember that hidden attribute is not the same thing as css presentation properties. It's just a convenient way of marking elements that are permanently removed from display list.

Please take a look at the docs here.

Also, remember that attribute selectors [attr] are not the best choice when it comes to performance.

Posted to for a better _.template() over 1 year ago

Why not {{varName}} for instance? Is it just a matter of your personal prefence or have you some other reasons to do so? I'm just curious.

Posted to Don't be a jerk, organize your code. over 1 year ago

@projectcleverweb I use spaces, because I do consider other people. On the other hand, this is so annoying (and still looks even worse in my IDE)

Nevertheless, great post, I agree with you in 100% (minus indentation :) ). I've spent the last year and half trying to organize the way both front- and back-end development teams in my previous company created web apps, despite the fact that I was responsible only for front-end dev / designers. And I have to say I'd be the happiest man on this planet if indentation would have been our biggest issue :)

I still don't understand how in the year 2013 there are devs who haven't heard of: git / mercurial / svn / any other versioning system. This crime should be punished with forcing them to use Adobe Version Cue for at least one year.
- CamelCase and snake_case in the same app are not the nicest gift you could give your teammate (ie. 10-page long style guide on your desk is there for a purpose)

If I may put my two cents in:

  1. please, remember that: someday, someone will read your code
  2. develop a styleguide (or use existing one)
  3. create a wiki for your project (it's easy because you're using github / bitbucket, aren't you?)
  4. document your API
  5. this one is particularly for JS devs: lint your code
  6. believe me or not, writing readable code is easy. People are afraid of change, some are just plain lazy, but in most cases those who write really messy code are somehow convinced that organization needs a lot of additional time, which is not true after one or two weeks. My personal definition of developer's job would be: it's creating solutions for problems in the most efficient, simple and organized way, providing structure and mechanisms that work and evolve. As Linus Torvalds said:

"If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program."

By the way, this quote appeared in a linux styleguide.

Posted to TypeScript from Microsoft over 1 year ago

Well I think, that what makes CoffeeScript so sexy is its syntax (and brevity) and that's the reason most developers decide choose it.
On the other hand, the biggest problem with CS is its incompatibility with ES6 syntax, using same keywords but with different meanings (take class for an example). In other words - CoffeScript is not futureproof. How does TypeScript handle that?


PS I really DO like TypeScript, but somehow coding in it feels like going back to my ActionScript times.

Posted to SCSS pure css arrows over 1 year ago

@manudwarf I've posted an example (with non-formatted source) here:
http://cssdeck.com/labs/w7y3rec6

Posted to SCSS pure css arrows over 1 year ago

Hm, that's funny, coderwall compiled @rules into html anchor elements,

Achievements
471 Karma
31,845 Total ProTip Views