tag:blogger.com,1999:blog-8215856523225150523.post5034468710725630926..comments2023-05-05T02:59:17.980-07:00Comments on sjs: 37signals' Chalk Dissectedsjshttp://www.blogger.com/profile/14285255211269339227noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-8215856523225150523.post-44414232140901052042010-11-05T14:53:28.009-07:002010-11-05T14:53:28.009-07:00Very cool code!
Good job guys...Very cool code!<br />Good job guys...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8215856523225150523.post-31037786152181360922010-11-05T13:35:31.436-07:002010-11-05T13:35:31.436-07:00The code was written in CoffeeScript[1] and then c...The code was written in CoffeeScript[1] and then compiled down to JavaScript. _ref is a CoffeeScript thing.<br /><br />[1] http://jashkenas.github.com/coffee-script/sjshttps://www.blogger.com/profile/14285255211269339227noreply@blogger.comtag:blogger.com,1999:blog-8215856523225150523.post-86617514580073971952010-11-05T13:33:59.585-07:002010-11-05T13:33:59.585-07:00Why is the variable "_ref" named with an...Why is the variable "_ref" named with an underline and "touch" is not with an underline ... found in the "canvas.bind" function (line 23)?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8215856523225150523.post-28276637874861381092010-11-05T12:19:40.191-07:002010-11-05T12:19:40.191-07:00That was a sweet post!That was a sweet post!Mikehttps://www.blogger.com/profile/16010963576677778438noreply@blogger.comtag:blogger.com,1999:blog-8215856523225150523.post-11874340939834565312010-11-05T09:00:02.091-07:002010-11-05T09:00:02.091-07:00Excellent analysis. A couple of clarifications:
[...Excellent analysis. A couple of clarifications:<br /><br />[x, y] is used in the touchend handler because the event.touches array is empty at that point. We push the coordinates on twice to ensure that a dot is drawn if you tap the screen without moving.<br /><br />The 10ms constraint inside the drawing loop restricts the amount of time spent drawing in order to maximize the time available to receive touch events. setInterval callbacks would never run concurrently if the loop were unbounded, but it could prevent us from receiving touch events.<br /><br />The output image's src is reset when the share window is closed to reclaim memory used by the image.<br /><br />Here's the full CoffeeScript source: https://gist.github.com/664351Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8215856523225150523.post-55174541395553912412010-11-05T08:15:35.766-07:002010-11-05T08:15:35.766-07:00Fuckin' beautiful code.Fuckin' beautiful code.Bijanhttps://www.blogger.com/profile/03323308464846759827noreply@blogger.com