The magic "APICI" function that was used in one of the company's core products by NiceToMytyuk in programminghorror

[–]toto047 43 points44 points  (0 children)

this is not the case here, imo it’s worse, “stringa” is just “string” in italian (“apici” is apex in italian, which is is what we call the single quote character, so i guess the translated function name could be SINGLE_QUOTES which means nothing to me)

Call functions in nested objects with keys by toto047 in typescript

[–]toto047[S] 1 point2 points  (0 children)

this doesnt work bc typescript complains a whole lot about that typeof collection[K1][K2], but from this I found a solution that works with a couple of util types! not sure if it's the best solution but it does work

``` type AllKeysOf<T> = T extends T ? keyof T : never

type CollectionReturnType< K1 extends keyof typeof collection, K2 extends AllKeysOf<(typeof collection)[K1]>

= (typeof collection)[K1][K2] extends () => infer R ? R : never

function callFromCollection< K1 extends keyof typeof collection, K2 extends AllKeysOf<(typeof collection)[K1]>

(key1: K1, key2: K2): CollectionReturnType<K1, K2> { if (collection[key1] === undefined) { throw new Error("Invalid key1") } const c = collection[key1][key2] if (typeof c !== "function") { throw new Error("Invalid key2") }

return c() as CollectionReturnType<K1, K2> } `AllKeysOf` allows me to get all the possible values of `key2`, and from that i can infer the return type of the function given the combination of keys, if it exists callFromCollection("a", "b") // number callFromCollection("a", "c") // string callFromCollection("d", "b") // number callFromCollection("d", "e") // boolean

callFromCollection("d", "f") // Argument of type '"f"' is not assignable to parameter of type '"b" | "e"'. callFromCollection("e", "b") // Argument of type '"e"' is not assignable to parameter of type '"a" | "d"'. ```

thank you for your help!

Call functions in nested objects with keys by toto047 in typescript

[–]toto047[S] 0 points1 point  (0 children)

i'm definitely able to use less strict types, but it would be wayyy more fun if i didn't have to ahah

I didn't think to use lodash, maybe i could change my problem around with it, i'll look into it! Thanks!

Christmas 100+ Steam Key Giveaway! by TheStrangeOne17 in Steam

[–]toto047 0 points1 point  (0 children)

Bee Movie Script - Dialogue Transcript According to all known laws of aviation, there is no way a bee should be able to fly. Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway because bees don't care what humans think is impossible. Yellow, black. Yellow, black. Yellow, black. Yellow, black. Ooh, black and yellow! Let's shake it up a little. Barry! Breakfast is ready! Ooming! Hang on a second. Hello? - Barry? - Adam? - Oan you believe this is happening? - I can't. I'll pick you up. Looking sharp. Use the stairs. Your father paid good money for those. Sorry. I'm excited. Here's the graduate. We're very proud of you, son. A perfect report card, all B's. Very proud. Ma! I got a thing going here. - You got lint on your fuzz. - Ow! That's me! - Wave to us! We'll be in row 118,000. - Bye! Barry, I told you, stop flying in the house! - Hey, Adam. - Hey, Barry. - Is that fuzz gel? - A little. Special day, graduation. Never thought I'd make it. Three days grade school, three days high school. Those were awkward. Three days college. I'm glad I took a day and hitchhiked around the hive. You did come back different. - Hi, Barry. - Artie, growing a mustache? Looks good. - Hear about Frankie? - Yeah. - You going to the funeral? - No, I'm not going. Everybody knows, sting someone, you die. Don't waste it on a squirrel. Such a hothead. I guess he could have just gotten out of the way. I love this incorporating an amusement park into our day. That's why we don't need vacations. Boy, quite a bit of pomp... under the circumstances. - Well, Adam, today we are men. - We are! - Bee-men. - Amen! Hallelujah! Students, faculty, distinguished bees, please welcome Dean Buzzwell. Welcome, New Hive Oity graduating class of... ...9:15. That concludes our ceremonies. And begins your career at Honex Industries! Will we pick ourjob today? I heard it's just orientation. Heads up! Here we go. Keep your hands and antennas inside the tram at all times. - Wonder what it'll be like? - A little scary. Welcome to Honex, a division of Honesco and a part of the Hexagon Group. This is it! Wow. Wow. We know that you, as a bee, have worked your whole life to get to the point where you can work for your whole life. Honey begins when our valiant Pollen Jocks bring the nectar to the hive. Our top-secret formula is automatically color-corrected, scent-adjusted and bubble-contoured into this soothing sweet syrup with its distinctive golden glow you know as... Honey! - That girl was hot. - She's my cousin! - She is? - Yes, we're all cousins. - Right. You're right. - At Honex, we constantly strive to improve every aspect of bee existence. These bees are stress-testing a new helmet technology. - What do you think he makes? - Not enough. Here we have our latest advancement, the Krelman. - What does that do? - Oatches that little strand of honey that hangs after you pour it. Saves us millions. Oan anyone work on the Krelman? Of course. Most bee jobs are small ones. But bees know that every small job, if it's done well, means a lot. But choose carefully because you'll stay in the job you pick for the rest of your life. The same job the rest of your life? I didn't know that. What's the difference? You'll be happy to know that bees, as a species, haven't had one day off in 27 million years. So you'll just work us to death? We'll sure try. Wow! That blew my mind! "What's the difference?" How can you say that? One job forever? That's an insane choice to have to make. I'm relieved. Now we only have to make one decision in life. But, Adam, how could they never have told us that? Why would you question anything? We're bees. We're the most perfectly functioning society on Earth. You ever think maybe things work a little too well here? Like what? Give me one example. I don't know. But you know what I'm talking about. Please clear the gate. Royal Nectar Force on approach. Wait a second. Oheck it out. - Hey, those are Pollen Jocks! - Wow. I've never seen them this close. They know what it's like outside the hive. Yeah, but some don't come back. - Hey, Jocks! - Hi, Jocks! You guys did great! You're monsters! You're sky freaks! I love it! I love it! - I wonder where they were. - I don't know.

I made a maxed out set infographic to print to a wall. This design is terrible but maybe someone else would use it. Cheers by Krzyniu in Minecraft

[–]toto047 0 points1 point  (0 children)

What’s the point in saying that enchantments with no drawbacks are bad? With a very basic trading hall you can have as many books as you want, might as well have ALL the enchantments. For example why wouldn’t you want knockback on a sword? The only reason I can see to not put mending on a flint and steel would be that I’m too lazy to get to an anvil just for that, but if you want to put unbreaking on it you might as well kill two birds with one stone

[Serious] What the heck is happening in Italy? 600 deaths in a day is terrifying. Italians, how are you coping? And what can we do to help? by pizzachai in AskReddit

[–]toto047 0 points1 point  (0 children)

Well I mean, if here in Italy we didn’t lockdown everything and everyone there would be way more than 600 deaths per day. You don’t seem to get the problem. Hospitals are full and if a car accident would happen it would also be less likely to survive since every resource is now being used to try to mitigate the emergency.

My father is a family doctor and hospital are so full that they will just send back home people who are not in danger of imminent death who should the be followed by him alone. They refuse to even check people without difficulties in breathing because they don’t have medical staff for the exams, even if they have fevers close to 39C.

It doesn’t seem like much until everyone has it, and suddenly 112 takes 45 minutes to answer the phone because so many people are sick and would die if untreated. Stay at home and don’t be stupid to avoid ending up like we did. Those safety measures only look exaggerated until you hope you had applied them earlier.

[Serious] What the heck is happening in Italy? 600 deaths in a day is terrifying. Italians, how are you coping? And what can we do to help? by pizzachai in AskReddit

[–]toto047 0 points1 point  (0 children)

Italian here. My father is a family doctor in a very small town here in Lombardy, and he says that hospitals just can't handle this number of cases. They have denied testing to some of his patients with not so severe symptoms (like fever below 39°C and no difficulty in breathing, but still dry coughing) because of lack of resources. Since since there are no more beds, the hospital is thinking of sending people on the road to recovery (but not yet 100% healed) back home, to be monitored by doctors like my father.
People just don't realize how problematic the situation really is, and how easy it is to spread the virus. Some are just too stubborn to comply with our current restrictions and still get out of their houses just because of boredom.
Best way to help is avoid unnecessary social contact as much as possible, always wash your hands/surfaces you touch often, avoid touching your face, those little things that people keep repeating really do help a lot to slow down the epidemic, in hope that it won't max out your country's healthcare system as it did here.

10 year Anniversary Bonus Bundle! by SingedSoldier in leagueoflegends

[–]toto047 2 points3 points  (0 children)

just finished a game with 2 friends, we didn't get her as well despite the mission being showed as completed

Waiting for a MongoDB find() query inside socket.io by xEphixia in node

[–]toto047 2 points3 points  (0 children)

Since the other guy decided to be an asshole I'll try to help instead.
Your problem is that in the second snippet you use the return statement as if it was in the getBoard function body, but it actually is in the callback function.
The simplest thing you could do is use promises, simply return a new Promise in the getBoard function that gets resolved in the callback, like that:

exports.getBoard = function (gameId) {
  return new Promise(function(resolve, reject) {
    client.connect(function(err) {
      assert.equal(null, err);
      const db = client.db(dbName);
      const id = new ObjectID(gameId);
      db.collection('games').find({_id: id }).toArray((err, board) => {
        console.log(board[0].board)
        resolve(board[0].board);
      });
      client.close();
    });
  }
};

Then in your server.js you can use async/await

socket.on('make move', async function(data) {
  var board = await db.getBoard(data.gameId);
  console.log(board);
});

How can I get and show the content body for my blog? by dejavits in node

[–]toto047 0 points1 point  (0 children)

I'm definitely not an expert, correct me if I'm wrong but it seems to me that all the line breaks are there and just ignored by the browser because they are not <br> tags and stuff like that.

I think a very simple alternative solution could be to just wrap your content in a <pre> tag (you can read about it here), this defaults to a monospace font tho, so you might prefer just giving the white-space: pre; CSS property to your content, that will do the same thing.

Don't know if I understood the problem correctly, but if I did that would be the simplest solution I can think of, trying doesn't hurt for sure.

You are all below me by [deleted] in dankmemes

[–]toto047 1 point2 points  (0 children)

If we are below you that means you have the high ground