HNHacker News
TopNewBestAskShowJobs

ts-jondin

10 karma · joined December 2, 2014

submissionscomments
ts-jondin··on Poll:Standing Desks - Yay or Nay
Yay, I got bad bad back and neck problems, I got an adjustable table at work; standing up now and then makes things better though it does require good footwear.
ts-jondin··on If a callback calls the enclosing function, would it be called a recursive call?
Edit: Oh, and as for the question itself, no I would not call it a recursive function just because it calls itself; I'd call it a self-referencing function. Where recursive functions are a subset of self-referencing functions.

1. Why does it matter?

2. Your first example I would simply call an asynchronous loop.

3. Your second example could possibly be called single recursion.

4. Recursion should at least consist of a base case and a recursive case, each self-reference should bring the input value closer to the base case which would end the recursion.

(Your second example has a recursive case and falls out into an undefined base case).

5. An example of 4 would be a tree structure where the base case is a leaf and recursion cases are branches.

  function walk (value) {
   if (Array.isArray(value)) {
    value.forEach(walk);
   } else {
    console.log(value);
   }
  }

  walk([[[1, 2, 3, [4, 5, 6]]],[[7, [8, 9, 10], 11, [12]]],13,14]);
would output: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
ts-jondin··on Ask HN: Why do people hate PHP so much?
Inconsistency, would be my topmost argument, in general. Among many other things these include what PHP dodges under the term "language construct" which when searched produces a wikipedia stub article with the only examples in PHP.

Failed closures that lack proper scoping, while they have been improved the underlying problem remains.

Continuation on inconsistency is that functions are not first class even though the syntax is the same for closures:

function foo () { } <--- This is a function

$foo = function () { } <--- This is a closure

Inconsistency; Cannot access functions (closures) directly from arrays.

$list["something"] = function () { };

$list["something"]() <- fatal error

What is "truthy" and what is "falsy", not unique to PHP but that doesn't mean PHP should do it.

Assumptions such as how it interprets numbers in octal

Functions do not follow any specific naming standard, i.e. some array functions are prefixed by array_*, some are not.

Include and require scoping is messed up as anything that is not a variable is mashed into the global scope.

Lastly in my post but far from all issues with PHP; A crap-load of legacy because "we can never break anything"

ts-jondin··on Ask HN: How to implement password reset without storing email on a server
If you were to require the email address upon registration but instead of storing it in plain-text you store a hash of their email.

When password resetting ask for email, hash and match it against you stored hash.

If matching generate new password and store it, send the generated password to the email input by the user. Though it would likely be preferable to send some form of password-reset-token instead of a password which allows them to change to a new password within X time.

This way you never store their email-address in a usable plain-text.

But if your question was more to alternate methods than email in any form, hmmm, nope, sorry, can't think of any right now that are less invasive on privacy with the same security benefits.

ts-jondin··on Is Google+ is a failure?
I'd say G+ is their single sign-on platform in addition to adding social media element beyond that. (This is likely not technically true but from a user point-of-view)

So, google apps and then some, Google+!