Tuesday, September 10, 2013
Great interactive tool for choosing easing function for your animation: www.gizma.com/easing/. Please note that c argument is not destination value, it's difference between starting value and end value. See this thorough explanation for more details and collection of links on easing.
Thursday, April 26, 2012
Thursday, February 16, 2012
Imagine we have some component system, similar to Dojo. Kernel find nodes, detects which components (let's call them widgets) they going to be coming from className or anything else. After that kernel must instantiate widgets and pass respective nodes and parameters.
So, we became all declarative and such, and it's just reasonable to store parameters near our node.
In my practice I saw three ways of doing that.
- Usage of expando attributes (like Dojo does) or
data-attributes (Bootstrap components).
- May stretch yor node to several LOC. You can make it shorter using JSON instead of several attributes, to make it faster and less verbose, but JSON requires keys in double quotes, and it conflicts with markup if you used to double quotes around attributes values
- Putting data in
input[type=hidden]that resides inside your widget.
Nameattribute became key and value of input became, er, value. Seems reasonable and may be useful, if your server-side puts extra data for itself in hidden inputs when rendering forms. But you should specify names inside your widget's code. Performance also suffer due to numerous DOM queries.
returnkeyword, and put it into
- Not very semantic and all, but this way has several advantages, which I describe next.
Pros of putting params through
- It's not JSON, so it wont conflict with markup.
- You don't need neither
eval(which is evil). You just call it as function — as easy as
var params = node.onclick().
onclick. So less typos, no missed parens and quotes, less bugs.
- Though it is not semantic usage of attributes, it can't break anything. Validator wont complain either.
- Not semantic. Purists gonna pure.
- It fires every time you click widget. Though it doesn't do much of job, performance can suffer slightly, I suppose. But you can use some other attribute — e.g.
ondblclick. Double clicks rarely appears and rarely occurs in modern interfaces. Anyway, it's minor impact and minor flaw of method.
- It can be hard to exlain this to people. Use this article as reference:)
I'm not inventor of this method parameters passing. I first met this approach while working at Yandex. JS in most their services use it; developer and browsers both seems happy with it.
Friday, January 20, 2012
Friday, January 13, 2012
Article confirmed my thoughts that writing:
you should blame yourself, not AIS.return 7
I personally go slight further: semicolons was design error in C back in 70th. There are no real need in writing several statements in one line, and never was. There are plenty of languages which never has semicolons as statement separators, and they prosper.
I definitely must translate that article to Russian.
Sunday, December 11, 2011
Today I found a staticloud.com, which provides static hosting at almost the same level of simplicity as DropBox. You just dragdrop your zipped files and choose subdomain, and after couple of seconds (watching upload bar) yoursite.staticloud.com is up and running. No ads and 1GB bandwidth per month should be enough for just about any static site.
They use Amazon's cloud. Great job!
P.S. There is similar tool: coralrift.com
Sunday, August 21, 2011
Since Makefile basically is shell script, you can use watever commandline-fu you learned. There is one thing to consider though: for loops.
for i in $(my-src-files) do; echo $$i >> $(my-dest-file); done
It takes me couple of hours to realize that one must use $$i when referencing loop variable instead of just $i like in plain shell scripts.
Sunday, April 24, 2011
requestFileSystemAPI. This API described quite detailed on HTML5 Rocks, but it gave no idea where my files are located on my hard drive. Process Monitor gaved me directions, and there it is. For each application, would it be site or extension, Google Chrome creates subdir in your %LOCALAPPDATA%\Google\Chrome\User Data\Default\FileSystem (on Windows (I'll give path for Linux later)). This subdir is named after application's URL, including protocol with slashes and colons replaced with underscores. For html5test.com it looks this way: http_www.html5rocks.com_0 Inside URL-named folder one can find one or two folders: Persistent or Temporary or both, which depends on type of access given application used. Inside each of them there is a directory with some kind of hash in name. And that hashed-name directory is root directory for your application's filesystem.