News for hackers. Stuff that matters.

shtylman

Re:TypeScript 3.7 on Tuesday November 05, 2019 @08:26PM (#21458858)
Can you hoist the `if (result)` into the `try` part of the statement? (Without seeing more context hard to know why that wouldn't work for you).

Another pattern to avoid the above is to remember that async functions return promises and that .catch() also returns a promise. So your above logic can be written as:

  const result = await funcThatReturnSomeType().catch(doSomethingWithErr);
  if (result) {
    doSomething(result);
  }
Re:SQL interface for Elasticsearch on Monday November 16, 2015 @04:51PM (#10577491)
Personally I find SQL much easier to read. In a product where you might allow users to write queries it is a much more pleasant UX experience to write and read SQL than it would be to do so for ES queries. It isn't a problem to understand how to build an ES query object but an ES query object is pretty terrible to read IMO.
It is none of their business why I needed my money or how many trips it took.
Re:Requiring NPM modules in the browser console on Saturday August 30, 2014 @11:23PM (#8248351)
the future is now
Re:SemVer has failed us on Friday August 08, 2014 @06:47PM (#8155491)
Duplicate dependencies affecting client side "size" is highly overrated. We can make tools (and have tools) that can compare files for same content and only include them in client side bundles only once. De-duplicating the same could should be a tooling issue. If I want to use client side modules that depend on two different versions of the same library I should be able to do this. Disk space is cheap and we can do the rest via post processing.
Re:SemVer has failed us on Friday August 08, 2014 @06:45PM (#8155485)
Systems where people seem to live under the assumption that if they don't get the latest patch updates or security updates their code will somehow be inferior and they will instantly be hacked. They think that semver will magically solve the problems of having to keep your application dependencies up to date if you want the latest changes/features/fixes.
Re:SemVer has failed us on Friday August 08, 2014 @06:42PM (#8155472)
Pinning in development is equally necessary if you hope to bring sanity to your development team all using the same codebase. Not pinning may be great for a one person 'team' or modules where you control everything, but can be a major time sink when one person is seeing a bug in a patch version they have and another developer is not seeing the same bug because they are on a newer patch. Allowing developers to "clone" consistent versions of the codebase is as important as deploying consistent versions to production.
Re:Localtunnel.me on Monday April 14, 2014 @05:52PM (#7589176)
Why should they reconsider it? Someone that just got into development and might want to show their friends or family something they are hacking away on. According to you they now need to learn about VPS, some random nginx settings or other SSH nonsense and meet some arbitrary "minimal" criteria you have decided upon because that is how you would do it. I think you should reconsider your acceptance of people that don't share your same technological expertise.
Re:Localtunnel.me on Monday April 14, 2014 @10:28AM (#7586333)
To me the ease of having the library be installable with the "canonical" package manager of my platform is too convenient; just "feels" more natural and simpler. I actually thought about writing a node.js ngrok client but then gave up on the idea since localtunnel was working well enough and I personally didn't need the other features from ngrok which I didn't have in localtunnel.

I wouldn't worry about the whole rewrite in c thing. If your server protocol is simple enough, writing clients in the native languages will be better than writing bindings. Installing bindings trips up a lot of users that are not used to compiled software.

Re:Localtunnel.me on Monday April 14, 2014 @10:07AM (#7586205)
You can. See the README.
Re:Localtunnel.me on Monday April 14, 2014 @10:01AM (#7586165)
Author of the project here.

I want to clarify why this project exists (as many seem to point out that other projects or methods exist for doing this).

TL;DR; If you think of localtunnel as just a shitty ngrok (or name your project here), you are missing the point and probably don't have the same use cases I do.

1. It was made overnight at some hackathon because I was not satisfied with the other tunneling options I found. They required either an account or some stupid ssh setup. I got to thinking of ways to create a tunnel that simply had an CLI tool and instantly get a tunnel no setup. It worked, I kept it.

2. It is written as a library first, CLI tool second. This means it can be used to create tunnels in a test suite if you want to use services like saucelabs to run browser tests (see https://github.com/defunctzombie/zuul). This is leveraged by projects like socket.io and engine.io (among others). This is perhaps the main reason I keep it around despite there being alternative CLI tools.

3. Both the client and server code are availably and easy to install and use. Companies do this when they want to run their own tunnels for privacy (or whatever their reasons... I don't care).

4. Yes, I know the name is identical to the old ruby?python? one. Whatever. That one seems defunct now anyway.

The fix for this is to use a module. Simple. Not a problem.
The generator example has no error handling (at least not from what I can see).

Once the "callback hell" example was re-written with named functions, it is not much different than the generator example and depending on how you are testing, easier to test because it separates out IO from logic (Which you could still do in the generator example).

One thing callback style code has begun to make me think about is the nesting/IO complexity of the functions a I write. When you nest, the IO/event boundary is visible in the code (by the indentation). As you continue to nest, you can start to get a clear idea of the amount of IO being done and where a particular function may be doing too much. Anyhow, most of this is preference anyway :)

Re:You will probably need jQuery on Thursday January 30, 2014 @09:05PM (#7154802)
I'll get the medic.
Re:You will probably need jQuery on Thursday January 30, 2014 @06:23PM (#7154094)
As long as every jquery plugin and other code that depends on jquery continues to require all of jquery, all this module stuff is useless. I am sure it helps you organize jquery Dev but it still doesn't help actually define real dependencies on a per component basis.
Re:You will probably need jQuery on Thursday January 30, 2014 @06:00PM (#7153962)
Lots of those are for Sizzle.

jQuery would be great if it broke up all those tiny little and completely orthogonal things it does into modules so that people could use them as needed. No one library is going to provide everything for every project but making everyone require your ajax code when all they wanted was an `offset()` function is equally backwards thinking. We have much better tooling now to work with modules and to reuse code.

Arguments about CDN caching are some sort of premature optimization (or I don't know what really). Most early projects don't need it and other projects can trivially use many of the free (or super low cost) CDN providers if they care that much.

My issues with jQuery are not at how awesome it has worked in the past or how well it has hidden/handled lots of browser quirks; it is that thinking in terms of "everything is dom manipulation" is the wrong abstraction for doing organized and maintainable front-end code. The things jQuery does well would be useful within smaller components or libaries but now we are back to the original issue of jQuery is one giant blob.

Re:Windows 3.1 written in JS/HTML on Saturday January 18, 2014 @12:06AM (#7080159)
This is a lie. The internet browser is way too good.
Re:The Great Firewall of Yale on Tuesday January 14, 2014 @08:04PM (#7060984)
This is very unfortunate that they are doing this if the data was scraped and not hitting their servers. Is it that some part of the data they think is copyrighted (like grades) versus just courses?
Re:The Great Firewall of Yale on Tuesday January 14, 2014 @07:40PM (#7060885)
I run a similar service for other schools (courseoff.com) and I have run into this before. I bet what happened was their site failed to cache the course data or seat information and was thus making lots of requests to the Yale servers. To Yale it might appear like a DoS from this site.

Obviously I don't know for sure but I would venture to bet this block was more an automated response than malicious intent against the site.

Re:Monolithic Node.js on Monday December 16, 2013 @02:14PM (#6917093)
You don't have to trust anything. If you want to NIH everything yourself, nothing is stopping you. It is however more likely that many packages on NPM are better than the ones you or your team can create if simply for the fact that they may have been created by a person very versed in the particular domain the package is for. Or maybe it will be shit but whatever :)
IMO bug bounty payouts are a more effective use of funds for a project. Paying per commit is like paying per line of code. At least with a bug bounty you (the giver) can specify which particular item interests you. If you want to donate money to the project as a whole, then it seems easier to just communicate with the project owner/maintainer and send them funds directly.
Because writing plain javascript is simpler for the majority of people to understand and will run in more places without the need for custom setups. Module authors will not write to these custom implementations since it would greatly limit the audience for their module.
Re:Why you shouldn’t be a Javascript Developer on Sunday November 24, 2013 @06:59PM (#6791769)
Lots of problems can be solved with one language depending on the language. And I have worked on several single language stack projects. Having a single language stack has many benefits. Right too for right job is only relevant if the right tool doesn't do many jobs good enough.
Re:High risk transactions on Monday November 18, 2013 @09:24PM (#6758860)
Don't be hatin' just cause you have never seen panic buying ;)
Re:High risk transactions on Monday November 18, 2013 @09:13PM (#6758814)
Ironically enough, due to check fraud that check might not help you as much as you think ;)

I don't know what algos they use to detect fraud but being a veteran does not always mean there won't be fraud on your bank account. Remember, this is not about those five 10 dollar transactions you authorized, this is about that one 5 thousand dollar one that was the result of fraud. From their point of view, a false positive is much better than a false negative.

Re:High risk transactions on Monday November 18, 2013 @09:09PM (#6758796)
The risk is not that your account will be debited, it is that you will go to your bank and claim the charge was not authorized by you after having moved the coins off their site. Now, maybe your bank account was compromised, and the attacker used your info to get coins. The bank will still refund you at the expense of coinbase. Remember, it isn't the "good" actors these actions are meant to protect against. A business like coinbase is a target 24/7 for many malicious individuals with access to lots and lots of compromised accounts.
Re:High risk transactions on Monday November 18, 2013 @09:07PM (#6758782)
What price would you then give the user?
Re:High risk transactions on Monday November 18, 2013 @09:05PM (#6758772)
Based on your username, I am going to assume you are referring to this lawsuit:

http://www.scribd.com/doc/139975904/Aaron-Greenspan-lawsuit

In which case you are the Plaintiff suing these companies which is very different than the US government suing them.

Re:High risk transactions on Monday November 18, 2013 @09:01PM (#6758751)
Yes, wires are much more difficult to reverse but they can be reversed. In my experience, your financial institution must get your prior approval before reversing a wire (which is not true for ACH reversals). Wires also you a completely different system of clearing funds which is part of the reason reversal requirements are different.

Older »