JavaScript smart functions and gists