1. 2

    After suffring the babel polyfill insanity, we switched to TypeScript for all our projects. Never going back to babel.

    1. 2

      This weekend I ported the sfxr sound effect generator to TypeScript, mainly as an exercise in using TypeScript and webpack together.

      https://github.com/srgpqt/tsfxr

      1. 2

        ruby is dynamic enough that I wonder why they didn’t just add this as a library? I wrote a wrapper class that does safe navigation in python as a joke a few years ago:

        https://gist.github.com/shanemhansen/4675780

        1. 2
          1. 1

            Well, ActiveSupport has try! and Avdi Grimm’s Naught library has a Maybe(thing) . So it’s not like there aren’t approaches to doing this already in Ruby, but this is far terser.

            To add to the alternate name suggestions above, I heard somebody calling it the “claw of demeter operator” which I thought was funny.

            My personal take on the operator: it’s going to make novice code a lot uglier, but it could be handy when used sparingly. For the most part I see it as a code smell, but that pattern is not going away so I guess embracing it in the language is alright.

          1. 2

            It seems like a waste of effort to me, FWIW. It’s not at all practical to use a browser without javascript on today’s web, so only a tiny number of people would benefit. Having extra code to support an obscure feature increases the future maintenance burden of the site.

            1. 2

              It’s not at all practical to use a browser without javascript on today’s web

              I do not find it very practical to use a browser that constantly pegs the CPU and then runs out of memory & crashes.

              1. 2

                Don’t do that then.

              2. 1

                When I’m done with it there will be less code and it should be easier to maintain.

                1. 1

                  It seems implausible that it would take less code to implement something without javascript than to implement it with javascript.

              1. 4

                What is the motivation behind this? Do you frequently use a browser that doesn’t use JavaScript?

                For the record, I’m not against this…

                1. 7

                  It kinda irks me a little bit when websites unnecessarily rely on javascript. Just a pet peeve of mine, to be sure.

                  1. 19

                    Life is short! If you die next week, is this how you want to send that last week?

                    (I use that question with myself often.)

                    1. 4

                      That is the wrong way to look at it. Unnecessarily running javascript, accepting cookies and generally being a negligent web user puts you and your privacy in harm. I use NoScript, RequestPolicy and Adblock with Firefox. After whitelisting all my main sites, I no longer need to even touch it, and my web experience is better because of this proactive discipline.

                    2. 1

                      wouldn’t lobsters be a lot slower without using ajax? Sending get and post request that require refreshes for everything would slow down the experience pretty extensively – enough to degrade the UX aswell… Not saying i’m against it, just not sure why..

                      1. 3

                        The existing ajax enhancements will continue to work as before, with the added benefit that things will also work if javascript is unavailable.

                  1. 4

                    I built a lightweight promise library for javascript inspired by jQuery.Deferred. Yeah, there are a few of those already but I enjoyed making it.

                    1. 2

                      I built a tiny library for making social network widgets (mainly Like/Share buttons with counters for facebook, linkedin, pinterest, github, gittip…), pulling the data straight from the source over AJAX with CORS and JSONP. This avoids loading all the crap the regular widgets shove down your pipe.

                      Been trying to come up with a name for it…

                      1. 1

                        “low-pro-so”

                      1. 0

                        Uh, no thanks. You can pry my JSON and YAML out of my cold, dead hands.

                        1. 6

                          For tabular data? JSON and YAML are great for serialization, but they both have a lot of extra punctuation, and require keys for each field unless you’re using arrays which makes the files slightly larger.

                          1. 1

                            Seems like a perfectly acceptable tradeoff to me, and it’s pretty much negligible unless you have a large number of empty string columns. And yes, you’d want to use arrays to make a fair comparison with CSV.

                        1. 2

                          Yes, jcs fixed a bug I introduced in the code. Sorry about that, should be good now.

                          1. 8

                            I don’t particularly like Go, for probably-subjective reasons, but I would still like to read technical articles about it. It seems obviously on-topic and relevant, so the request to stop posting about Go comes across as rude.

                            1. 0

                              I believe Go is actively harming the software industry by providing a very incapable tool for building working software, yet it’s presented as a real alternative. I do not think it’s responsible to let others get introduced to such silliness.

                              1. 7

                                I would have to disagree, as I find it quite suitable for building useful real world systems. I believe the CoreOS people would also disagree with you, as would many other people and organisations.

                                1. 0

                                  I will have to disagree and claim that the suitability is an illusion.

                                  1. 10

                                    I, like many others, have built useful real-world systems in other languages. I didn’t start using Go because I was forced to. I’ll leave it at that.

                                    1. 4

                                      Go like many languages is suitable for some tasks, and not for others. What about it is actually harming the industry, other than cases where developers misuse it (something that can happen with any tool)?

                                      1. 9

                                        No parametric polymorphism (i.e. generics) - let’s not even go past this point. It’s so fundamental that giving it up is accepting defeat by your programming language.

                                        Types are proofs (see the Curry-Howard isomorphism) - this has many consequences but one is that we can use types to prove properties about values and functions. Easy, right? People will say “I don’t care about proving that an int is an int” but they’re missing a huge implications - one being: parametric functions create cases where there’s only a limited amount of implementations.

                                        Given a function with the type:

                                        a -> a
                                        

                                        (i.e. a implies a)

                                        What are the possible implementation(s)? Let’s try to implement it:

                                        parametric :: a -> a
                                        parametric a = _
                                        

                                        What can we put in the underscore hole? We need to produce an a, what are the possible a values which we have in scope? The only reasonable answer we have is a. This means, that given the signature a -> a, there is only a single implementation.

                                        We don’t need anything else from this function, no tests, no names, no comments - nothing but the type signature to know exactly what this function does.

                                        That’s a pretty simple example, right? Let’s take a real world problem that I had yesterday:

                                        I wanted a function which would take a list of disjunctive types and give me a list of just the right sides:

                                        [Either3 a b c] -> [c]
                                        

                                        Now, I could write this function directly against the list and Either3 types but there’s a chance I could do something like:

                                        getRights :: [Either3 a b c] -> [c]
                                        getRights xs = []
                                        

                                        So, getting all the rights from my list returns an empty list - not what I want! If we make this type signature very generic, then we get to a place where we only have a single possible implementation:

                                        unite :: (Monad m, Plus m, Foldable t) => m (t a) -> m a
                                        unite value = value >>= foldMapPlus return
                                        

                                        Here are example usages:

                                        unite [Right 1, Right 2, Left "Whoops", Middle False, Right 3]
                                        -- [1, 2, 3]
                                        
                                        unite [Just 1, Nothing, Just 2]
                                        -- [1, 2]
                                        

                                        Not only have we specified exactly what should happen in the type but we’ve gotten a function which works for infinite types.

                                        I consider writing programs without free theorems to be absolutely archaic. Recommending for people to do exactly that (by advocating Go, for example) is harmful.

                                        1. 7

                                          You didn’t actually say how it was harming the industry. You just stated that you prefer programming languages with certain properties.

                                          Also, it’s clear that you care very deeply about advocating for the functional paradigm. It would help your case if you didn’t include flame bait in your comments. (For instance, I’ve used Go effectively. But your comments would have me believe that I’m just deluded. But I’ve also used Haskell effectively. Am I deluded about that, too?)

                                          1. 1

                                            It’s not a preference, advocating programming without free theorems is harmful. I did say that:

                                            I consider writing programs without free theorems to be absolutely archaic. Recommending for people to do exactly that (by advocating Go, for example) is harmful.

                                            And yes, I believe it’s an illusion that Go is effective at solving problems.

                                  2. 6

                                    You could argue the same about PHP, Java or $whatever_language_you_dislike.

                                    1. 3

                                      Yes and I will, keeping in mind that Java is the most capable.

                                    2. 3

                                      That’s exactly like saying “Let’s not talk about drugs because they’re bad.” Well, how do you tell others that drugs are bad without talking about them, discussing them, etc?

                                      The same argument has been made about sex-ed and abstinence-only education. Guess what, when persons who’ve only been told “just don’t do it” do it and don’t know the first thing about the consequences, bad things happen.

                                      So let the topic come up here. And if Go really is so terrible, then let it be discussed. Give others the opportunity to learn and understand what makes Go the “literally Hitler” of programming languages (or whatever might be good about it).

                                      1. 1

                                        Let’s talk about drugs. Let’s not present drugs to people without experience, telling them that it’s a great idea.

                                      2. 2

                                        Go does exactly what it sets out to do: make solving Google’s problems using code easier. Anything else is a nice side effect of Go making it easier for Google to do things.

                                    1. 2

                                      This would probably have to be done server-side, otherwise you’d end up with pages with fewer stories (or even none, if you hide them all).

                                      Compensating for that on the client-side would be… yucky.

                                      Edit: re-read your suggestion and yes, if the stories are grayed out instead of hidden, then client-side is doable..

                                      1. 1

                                        Agreed. I realized that when done client-side, you’d end up with gaps. Greyed-out would at least allow me to see that I’ve already read read the post (or I’m not interested etc) without rendering issues.

                                        1. 1

                                          Doesn’t your browser already show visited links as slightly more grayed out?

                                          1. 1

                                            Yes it does. Of course, I have to open those posts to grey them out. If the post doesn’t interest me, this activity is a waste of time. If I’ve already read the post contents via the lobste.rs email, this is redundant.

                                            I can see how this request is probably a niche desire though.

                                            1. 1

                                              Actually, I agree it has some value.

                                              On the serverside, though, it requires keeping track of every story that you’ve hidden and filtering on that. I guess that’s probably not that much worse than per-user filters we already have. Maybe the hidden stories could be “aged” out, so that you don’t accumulate too many over time.

                                      1. 11

                                        I’ll be working on an iOS/Android client for lobste.rs called Pinchy!

                                        I made a start on the iOS client over the weekend, and have some basic functionality done.

                                        1. 4

                                          Cool! Have you seen this Github issue about a previous attempt? The API never fully materialized because OAuth scares me.

                                          1. 1

                                            Yeah, I’ve seen that. At the moment I’m just parsing the HTML; I didn’t want to get caught up in the server side of it quite yet.

                                            1. 3

                                              Beware, the HTML structure is quite prone to changing.

                                              1. 2

                                                @mongey: Yes, even without an authenticated API, fetching JSON representations of pages would be much easier. Just stick .json at the end of a story ID like https://lobste.rs/s/e04ccq.json

                                              2. 1

                                                How are you parsing the HTML?

                                            2. 1

                                              I had a short play with making an Android lobste.rs client. I’m still very interested in this. Are you open to collaboration on Pinchy for Android? I also bring UI design skills to table.

                                            1. 3

                                              tldr; lots of Storm related stuff

                                              at the day job:

                                              Building a new 64 node Storm 0.9.0.1 cluster at work. New offline jobseeker - job matching infrastructure to run inside of Storm.

                                              at night:

                                              More work on the book I’m coauthor of “Storm Applied”.

                                              1. 1

                                                Interesting. I work on the other end of the job market – mainly building services for recruiters. My coworkers are rewriting our aging job classification system to work with Storm.

                                              1. 10

                                                I like weekly threads, they build a semblance of community.

                                                I set up a Dokku / postgres box and migrated all my stuff over from supervisor / SQLite this past weekend. There’s a bunch of miscellaneous cleanup stuff left.

                                                I want to get back to contributing to Rust once I finish up writing the tests for autojump.

                                                1. 8

                                                  Yes, please let’s make this a tradition, asking “what are you working on this week”. It’s like a coarse-grained twitter for programmers and open-source projects.

                                                  I’m on vacation, but contemplating moving a project from sockets to zeromq (https://github.com/vjoel/tupelo) and writing a talk proposal for MountainWest Ruby Conf (http://mtnwestrubyconf.org).

                                                  1. 3

                                                    consider going straight to nanomsg, zeromq’s successor by the same author.

                                                    1. 2

                                                      Thanks for the tip. A little put off by “WARNING: nanomsg is still in alpha stage!”. Nanomsg has been mentioned twice before on lobste.rs, but without discussion:

                                                      https://lobste.rs/s/buukh6/nanomsg_mit-licensed_zeromq_alternative https://lobste.rs/s/9lmnfh/gettings_started_with_nanomsg_examples_in_c

                                                      I will start a new thread asking for comments on nanomsg vs zeromq.

                                                  2. 2

                                                    Great, if you have any ideas for other weekly threads, I’d love to get one a day for each day during the work week.

                                                    1. 2

                                                      Thanks for maintaining autojump, it’s a great little tool.