1,298 karma · joined Mar 27, 2012 (14y ago) · 493 submissions
comment 3y ago · link · parent
If you have a stack of items, you can pick up half of them by right-clicking on it, which is very convenient when you're dividing out a stack on the crafting grid to make many copies of a recipe that needs that item in 2 or 4 slots; but for some recipes, you need to put the same item in 3 or 6 slots, and there's no built-in way to divide a stack into thirds.
So I made an AHK script that, when I held down a key, would
- pick up half of the items in the stack I'm pointing at (right-click) - move the mouse one inventory space to the right - put them down (left-click) - pick up half of them again - move back one inventory space left - put them down, adding them back to the original stack - and repeat
and it would only stop after one of the "pick up" steps; so, after a few iterations, you'd be left with the stack divided into equal thirds, two in your inventory & one on the mouse.
Eg, starting with a stack of 60, it goes 30/30, 45/15, 22/38, 41/19, 20/40, 40/20, 20/40, 40/20... then release the key, and you've got three stacks of 20.
comment 6y ago · link · parent
https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/...
comment 6y ago · link · parent
AIUI, the only "container" functionality built-in to the browser is... infrastructure, I guess you'd call it: Firefox provides all the tools for addons to do stuff with containers, but doesn't actually do anything with them itself.
comment 6y ago · link · parent
[0] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
comment 6y ago · link · parent
Compare to, say, POSIX or Vim[0] REs, where some punctuation characters are special with a backslash, others are special without, and I can never remember which is which.
[0] Regardless of the state of the "magic" option - the only way to get consistent behavior is to start every single RE with either \v (which works like PCRE) or \V (which works like your proposal).
comment 6y ago · link · parent
> “Who does all that? Nobody,” said Sanborn.
I do! It's a little fiddly, but any sharp knife with a point you can slip under the label does a good enough job of slicing those off.
Good to know that helps, actually - I've often wondered whether I was wasting my time bothering with it.
comment 6y ago · link · parent
Per the Guidelines, https://news.ycombinator.com/newsguidelines.html:
Please don't submit so many links at once that the new page is dominated by your submissions.
comment 6y ago · link · parent
In practice, you don't really need one - the safe alternative to "xs !! n" is pattern-matching on the result of "drop n xs", as that's [] if xs has ≤n elements:
https://www.haskell.org/onlinereport/standard-prelude.html#$...
comment 6y ago · link · parent
Not quite - for example, these both benefit from foldr, despite each producing a scalar:
and, or :: [Bool] -> Bool
and = foldr (&&) True
or = foldr (||) False
... as they can both "bail out early" without evaluating the entire list (if they find a False or a True, respectively).The distinction lies not so much in "are you reducing to a scalar?" as "can your binary operation be productive without evaluating its second parameter?" - or, if you prefer, "is it ever lazy in its second parameter?". If so, then foldr may be appropriate.
comment 6y ago · link · parent
https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/r...
comment 7y ago · link · parent
comment 7y ago · link · parent
I don't know if it implements any techniques from that paper, but it does let you search for definitions by type signature. Of note, it also does a pretty good job of finding results with different-but-compatible types, which is very valuable in a Haskell context given all the polymorphism.
comment 7y ago · link · parent
Abstract:
Nicotine is the major neuroactive compound of tobacco, which has, by itself, weak reinforcing properties. It is known that levels of the enzymes monoamine oxidase A (MAO-A) and MAO-B are reduced in the platelets and brains of smokers and that substances, other than nicotine, present in tobacco smoke have MAO-inhibitory activities. Here, we report that inhibition of MAO dramatically and specifically increases the motivation to self-administer nicotine in rats. These effects were more prominent in rats selected for high responsiveness to novelty than in rats with low responsiveness to novelty. The results suggest that the inhibition of MAO activity by compounds present in tobacco smoke may combine with nicotine to produce the intense reinforcing properties of cigarette smoking that lead to addiction.
comment 7y ago · link · parent
And even with all costs taken into account, it took a perfect storm of factors outside their control for their actions to actually change the result. I doubt they even expected that outcome themselves.
[1] https://www.bloomberg.com/news/articles/2017-06-13/russian-b...
[2] https://www.theatlantic.com/politics/archive/2019/03/mueller...
comment 7y ago · link · parent
The Kremlin internet propaganda project had, at its peak, a budget of more than $1.25 million per month. It was doing a lot more than just buying adverts.
https://www.theatlantic.com/politics/archive/2018/02/mueller...
comment 7y ago · link · parent
I figure something's timing out on the first attempt, but various bits get downloaded & cached before it fails, meaning the second try runs fast enough to not hit the same timeout.
comment 7y ago · link · parent
comment 7y ago · link · parent
Of course, that only works for active users - it won't upgrade anyone that never logs in. Depending on just how weak the old hash is, you may want to eventually cut off any lingering un-upgraded accounts: just forget their old hash, requiring them to go through your password reset process should they ever come back. If you've left it long enough, those accounts will probably never be used again anyway, so that should be NBD.
comment 7y ago · link · parent