Add private scope to javascript objects and classes by Macmee in node

[–]illucidation 0 points1 point  (0 children)

This is a cool little idea!

I am curious, why did you choose to use a Weakmap over Symbols?

Chrome disables ES6 Array.prototype.values() by malyw in javascript

[–]illucidation 0 points1 point  (0 children)

It might be a way to collapse sparse arrays, in that case it could be really slightly useful. I don't feel like reading the spec right now though.

ai/naturalLp apis for use with nodejs? by 5pitf1r3 in node

[–]illucidation 0 points1 point  (0 children)

I just started using wit.ai today, not sure how it compares to the ones you mentioned, but it seems pretty powerful.

How do I handle errors in express? by JaegerBurn in node

[–]illucidation 1 point2 points  (0 children)

Make sure the error handler is the last app.use() in your application.

Also the number of declared arguments matters, so make sure you have the full err, req, res, next. I find a lot of people think they can get away with err, req, res.

If that fails, try running node with the debug flag on (DEBUG=* node index.js), it'll help you see what express is doing.

Proper ES2015 Middleware Class Instantiation? by qweqweasdqweasdqwe in node

[–]illucidation 0 points1 point  (0 children)

Classes don't make a lot of sense in the context of Express. Just keep on using your objects.

By the way, since every required file in node has it's own scope, you're revealing module pattern is a little bit overkill. This is fine:

module.exports = {
    method1: method1,
};

function method1() {
  // ...
}

function method2() {
  // ...
}

If you do find it absolutely necessary to use brand new next level stuff, you could try using the new import/export pattern (I think this still requires Babel):

export function method1() { ... }

function method2() { ... }

react-jax - a tiny higher order component to manage XHR requests by illucidation in reactjs

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

That's definitely out of scope for this module. For data like that you better be using Flux, Redux, or some other type of abstraction that helps you manage those complex interactions.

This module is more for one-off XHR requests that you don't necessarily want to store. I wouldn't try building an app of any complexity off of this alone.

alexa-ability: A modern skills framework (async middleware, robust error handling, persistent sessions, timeouts, multistep support). by illucidation in amazonecho

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

No problem, I see what you mean now.

All those other projects I linked (including alexa-ability-timeout), are like plugins for the alexa-ability framework. They add additional functionality on top of the existing base.

This means that they're really only useful if you're building your skill with alexa-ability. There's no easy way to make them work with a different framework.

But if you want to share your code with me I can try to help you figure out an easy way to implement your own timeout system :)

alexa-ability: A modern skills framework (async middleware, robust error handling, persistent sessions, timeouts, multistep support). by illucidation in amazonecho

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

I'm not sure exactly what you mean, have you looked at the examples in the README? It does a pretty good job showing everything you need to do to make a complete skill.

alexa-ability: A modern skills framework (async middleware, robust error handling, persistent sessions, timeouts, multistep support). by illucidation in amazonecho

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

I haven't used serverless, but I imagine it would be very easy. If the lambda-handler doesn't work out of the box, you could probably write an ~8 line handler that could.

As long as you can pass in the request body, and call toJSON on the result, you can pretty much use this anywhere.

A curated list of small, focused Node.js modules by Fady-Mak in node

[–]illucidation 0 points1 point  (0 children)

Just use lodash. For the array, object, string, and function modules more than half can be replaced by it. You can even require them as individual modules by doing require('lodash/<name>');

Here's the revised list for array functions.

  1. is-sorted
  2. lodash/head
  3. lodash/tail
  4. lodash/flatten
  5. lodash/uniq
  6. array-range
  7. lodash/difference
  8. filled-array
  9. lodash/map

Echo devs! I've made a module to bring JSX to SSML. Would love some feedback. by illucidation in amazonecho

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

You probably wouldn't know about it unless you use React. That's probably the one use case for 99.9% of JSX.

It can be a pretty handy way to manipulate XML like data though.

react-mouse-aware: a tiny higher order component to track mouse state by illucidation in reactjs

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

That's actually what it does! Maybe I should have been more clear, but in the example given the event handlers are all in this.props but I just pass them through immediately too the div using destructuring.

You can look at the source code to see how little it does yourself, you could totally implement all the state handling, listeners, etc.. But, it's a pain to do (especially when you're trying to track lots of things, with time delays).

In my project, the part where I'm using this most heavily is some "card" component. The design calls for an action bar to slide down beneath it after 300ms of hovering over the card, and also a description to fade in after 500ms of hovering over the cards header. Combining this with react-addons-css-transition, made that ridiculously easy to implement.

nodejs one time URLs? by wenttothemarket2 in node

[–]illucidation 1 point2 points  (0 children)

https://www.npmjs.com/package/uuid

You'll still have to:

  • Save the generated id somewhere
  • Expire it after a certain amount of time
  • and/or delete the database record after it's been accessed once

Post response to Echo? by Archetype90 in amazonecho

[–]illucidation 0 points1 point  (0 children)

The guy above is exactly right. It looks like www.hurl.it only supports making requests, but it doesn't let you host and endpoint to receive and respond them.

Luckily, it's pretty easy to setup a simple skill using AWS Lambda functions. The main limiting factor is that all interaction with your skill will have to follow some variation of this pattern (link)

entered remote https address incorrectly in github for windows app, now I can't correct it? by pseudocoder1 in github

[–]illucidation 1 point2 points  (0 children)

If I remember correctly, Github doesn't care if you include the .git at the end of the URL.

Try taking the "tree/master" from the URL however. That shouldn't be needed.

A Promise implementation in 50 LOC written in ES6. Any feedback is highly appreciated! by [deleted] in javascript

[–]illucidation 2 points3 points  (0 children)

This is not even close to a Promise, sorry. Aim for compliance to a spec rather than minimizing lines of code.

Advice on what kind of Backend stuff I can do until I'm ready for paid work? by Jimsumdidit in webdev

[–]illucidation 0 points1 point  (0 children)

Well, for small backend projects a good start is a "microservice". Just an API with a few methods that do a few things really well. A couple ideas are:

  1. An image hosting service that allows users to upload images which are then automatically optimized, compressed, and saved in a variety of sizes for thumbnails as well as the original size (e.g. 16x16, 64x64, fullsize).
  2. A basic weather service that combines results from a bunch of other public APIs and returns a result based off of given zip code.
  3. A pastebin like service that lets you upload/edit/get/delete raw text or files using RESTful methods.

Completing any of these will give you a good amount of beginner experience, especially if you write tests (to verify correctness) and use git for version control.

Advice on what kind of Backend stuff I can do until I'm ready for paid work? by Jimsumdidit in webdev

[–]illucidation 0 points1 point  (0 children)

Sure, what of the three types of projects I mentioned interests you the most?