Thursday, 14 December 2017

When I want to buy a shirt I write a shell script


I want to buy a shirt. It's a beautiful one. But unfortunately it is unavailable in my size. I need a solution that checks the product page regularly and notifies me when the shirt is available.


The URL of the product page.


Some kind of notification that lets me know my shirt is available.


Don't spend more than a few minutes on this, write a throw-away solution. It doesn't need to be fool-proof or portable. Environment is cygwin.


Anything more than a simple shell script feels like an overkill. The notification can't be email because I have no access to an smtp server, let's use 'cygstart url'; it will open the product page in a browser. Wouldn't be acceptable if, for example, I used this computer for presentations, but it's a good solution in this case.
The script's first parameter is the product page including the product-specific query string, the second parameter is a html fragment that represents the product on that page.

while true; do
    NUM=`curl -s $URL | grep "$FRAGMENT" | wc -l`
    if [ "$NUM" -gt 0 ]
           cygstart "$URL" 
    sleep 60m

Tuesday, 21 March 2017

About the JavaScript community

JavaSrcipt is a very capable and in many ways a beautiful language. I love the good parts of it, especially when it is used in FP style. I can't say the same about the community. It's the kind of community that demands adding classical OO and classical inheritance to a language that had a completely different philosophy. It's the kind of community that doesn't care about the soul of a language. I don't think OO or classical inheritance has anything good to do in ES6.
I also don't think it is a good idea that you are supposed to orchestrate minimum half a dozen of tools for "modern JavaScript programming". I also don't believe that anyone in their sane mind could reason for 600 node modules when I scaffold a chrome extension project with yeoman (generator-chrome-extension). Of which modules I looked at two; one of them was a one-liner, the other one started with the comment "this entire module is depressing". For the same reason I can't be impressed by the exponential growth of the npm modules, because, well, most of that is garbage.
The majority of the JavaScript community are still the same copy-paste-i-dont-understand-what-i-am-doing-and-ask-basic-questions-on-stackoverflow guys as it was ten years ago. Actually it feels like the sole purpose of all these tools is to make copy-paste manageable on the enterprise level.