Hacker News new | past | comments | ask | show | jobs | submit | rednafi's comments login

It’s trivial to do with nominal type.

In Python:

```Hash = NewType('Hash', str)

def generate_hash(what: str) -> Hash: return Hash(f“hashed_{what}”)```


What makes it trivial here isn't nominal vs structural typing but rather that Python has a utility function for this case while you have to implement it yourself in Typescript with a one-liner.


I don’t like having comments on my blog. I write the posts out of my own necessity and don’t want strangers to stomp on them.

Sometimes if someone finds something useful, they appear at the front page of hackernews and people can discuss it there.

That being said, I never understood the appeal of medium or substack. I have a simple site built with hugo and posting new contents is as easy as doing it on any of those platforms.

Also, people care a wee bit too much about the audience. If your stuff is useful or interesting, people will find it.

site: https://rednafi.com source: https://github.com/rednafi/rednafi.com


Yeah, same. Otherwise, domain and protocol error codes become a confusing mess.


I feel like people tend to overthink in this regard. If SHA-256 hashing is good enough for GitHub's REST endpoints, it's good enough for me.

If you're implementing weak validation, then you might need to preprocess the payload before running it through the hash function. For example, if your payload is JSON and you want to make it format-agnostic, then you'll need to normalize the payload and then compute the hash.

In either case, the hashing algo probably doesn't matter as much.


Hmm... Chrome seems to handle this quite well, at least in my experience. I'm curious about what sort of issue you encountered.


same as above


I came to the game at the tail end of the Vim-vs-Emacs war.

People pick up a particular editor not because it's always objectively better, but rather because it was the only available thing they liked at a certain point in time. Then, over the years, Newton’s first law takes over.

Since I stepped into the industry only a few years ago, I didn’t see the appeal of spending so much time configuring a tool. So, neither Vim nor Emacs seemed like a sensible choice. I went with VSCode and forgot when was the last time I had to configure something.

Now that we're seeing new editors like Zed making some splash, I'm exhibiting the same bias for VSCode that older programmers show for Vim or Emacs.


Yeah I use nano if im remoted in and need to make a quick change and vscode the rest of thr time.

My thinking is that if you need vim you actually need an ide or lightweight ide.


> People pick up a particular editor not because it's always objectively better, but rather because it was the only available thing they liked at a certain point in time.

I've been programming for I dunno, over twenty years I think. I tried many different editors, tools, IDEs, specialized apps. I kept moving around. Started from Turbo Pascal and Borland tools on DOS, then continued using Borland Tools in Windows. Borland was fucking huge at that time, to the point (and I kid you not) that one of my college mates told me: "dude, I just learned that the first name of Pascal (the mathematician) was Blaise...I thought all this time that his name was Borland... That's how the company got its name, I thought..." I mean, he was not kidding, he seemed genuinely confused.

Later I used Visual Studio (not VSCode). That was some almost absurdly heavy beast. It could die in the midst of compiling a project. The versions were so incompatible, often you couldn't even take a project created in one version of Studio and simply open it in the newer version. And so, often you'd have to have multiple instances of that thing open. Visual Studio had everything, including something called TFS (Team Foundation Server), that had tons of features for project management and some other crap, but for some reason most teams only used arguably the crappiest feature of TFS - the version control. It was quite some stupid shit and made me mad almost daily. When I discovered Git and learned it a bit, I stopped using stupid TFS, but I couldn't convince my team to switch, so I had to use a bridge to push my things to TFS. While I was learning Git, I accidentally stumbled upon Vim, and of course the first time seeing it I simply couldn't figure it out. I cursed out, and found a way to set a different editor as a default one. But shortly after, it made me thinking: "why would Git, such a clever and awesome tool choose to use this weird Vim-thing as a default editor?" I got intrigued and started learning Vim. After a month of hating myself, I suddenly realized that I no longer know how type in my editor like I used to. From that point on, whatever editor or IDE I would use, I invariably used with a vim-plugin. And If the tool didn't have one, I would just refuse using it.

Then followed Sublime, Atom and finally Jetbrains products - WebStorm, Pycharm, RubyMine, IntelliJ Ultimate. I stayed with IntelliJ the longest - around seven years. I explored every single imaginable documented and not so-well documented feature of it. I had a huge poster on my wall of a printed cheatsheet. I discovered, reported, discussed and followed tons of bugs. Funny, sometimes, even now, I still get updates for things I filed back in 2012-2014. I felt like Andrey Vlasovskikh (at that time) maintainer of IdeaVim plugin had become my family. I loved IntelliJ. It was great. It had everything I wanted. If I ever felt the urge of thinking that I wanted something that it didn't have, I convinced myself to want less. For a relatively short period I had to use XCode, and OMG, compared to it, IntelliJ felt like a godsend.

And one day, I took a flight from New York to San Francisco. My next-seat guy opened a laptop and started typing things in Emacs. I just couldn't help it. First, I pretended to be asleep and kept peeking. After forty minutes of that lame game, I simply couldn't hold it anymore and started asking questions. Until that point in my career, I haven't seen anyone coding like that guy - without googling things; without StackOverlfow; without constantly jumping between documentation, terminal console, utility apps, and the editor. It was all in one place. It was clean and strangely ascetic - no toolbars or menu, no icons, no progress bars, no multitude of numbers indicating different things. Another thing that fascinated me was how easily he manipulated window panes using only the keyboard. Clearly, he was "in the zone" - it seemed as if he had zero context switching. That was very different from how I wrote code and most of my colleagues as well. And he wasn't using some esoteric, little-known language. He was writing in Golang. I didn't know it then; still, it wasn't some completely alien thing to me. Yet some things I saw almost mesmerized me.

That flight, though, wasn't enough to inspire me to try Emacs. Soon enough, I forgot about it. Three months later, I made a jump in my career. At my new job, there were a handful of Emacs users. I learned many new things from them (unrelated to Emacs). And that's when I installed Emacs on my machine for the first time. It still would take me another two years to transition. At some point, I realized that I have multiple things - IntelliJ, Vim, Emacs and Sublime (or Atom) open all the time, and I decided that I needed to start making cuts. My first fear was that I woudn't be able to vim as efficiently in Emacs as I used to. I was wrong. My second and major fear was that if I invest myself in learning Emacs, one day I inevitably find something that's not possible in Emacs, but still doable in IntelliJ and I would feel handicapped and would have to give up and move back and feel bitter for wasting my time. And once again, I proved to be wrong.

Today, I cannot imagine doing any meaningful work without Emacs. From time to time I open AndroidStudio or VSCode and try to figure out some basic workflow there, but always move back to Emacs. It is hard to explain what makes Emacs such an irreplaceable tool for me - I'd have to write a book. But I do remember one of the first things that won me over. Search. Emacs has superior search I have not seen in any other tool. It offers too many different ways for searching things - locally, remotely, recursively, partially, contextually, dynamically, etc. With filtering the results and sifting through and editing at the same time.

I dunno, I feel I pick Emacs over and over specifically because it is objectively better. For me. Someone else may have different opinion and their experience may not be the same, but I swear, no other editor or IDE makes me feel content. And not because I have little patience to learn new tools. I do very much like tinkering around my tools. And I do firmly believe that knowing my instrument well is not a part of my job. It is my job.


Managers need to eat too.


Profanity works fine as well.


I like the syntax and the type system but it’s written in Java, why?


JetBrains Mono ftw. Also, what’s with this weird slash swapping after the trial period!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: