Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Some feedback on a library I've made

The Backstory

Some 3 years ago, I've written a jQuery plugin, called jEntropy. I pretty much created it out of boredom. My friends and I were talking about random generators and ways of getting true randomness, as opposed to pseudo-random generators which are the standard way of doing things.

I got home and started fooling around with the mousemove event. I got the coordinates from user movements and used them to create a 'seed' for a random string. After some further tinkering, I turned it into a jQuery plugin, published it on GitHub, added it to the jQuery plugin repository and promptly forgot about it.

Fast Forward

I recently got a job offer, based on some recruiter finding the library on my GitHub profile. While I politely declined the offer, the whole event made me thing about the plugin. I decided maybe I should rewrite it, maybe even add support for mobile devices.

Presenting ntropy.js

First of all, it's not a jQuery plugin anymore, it's a standalone library. It listens for mousemove events on desktop devices and devicemotion events on mobile phones and tablets. It's more bare bones than it used to be (the old version included modals and whatnot, letting the user know to start moving the mouse). This one doesn't do that, it lets you decide how to use it.

Unlike the old version, this one gives you a callback which gets executed after the random generator is done, allowing you to do whatever you want to with the random string.

A really quickly made webpage for the plugin is here: http://www.dinopaskvan.com/ntropy.js/ It features some demos showing off some of the things you can do with it.

The repository is here: https://github.com/dpskvn/ntropy.js/

To Do

  • [ ] I need to write some real documentation for it.
  • [*] I also need to move my build process from CodeKit to grunt.
  • [ ] And possibly add some tests.
  • [ ] Not to mention that I have to fix all the bugs I've unknowingly made. :)
  • [*] Publish on Bower

I would really appreciate any kind of feedback/testing/whatever. Cheers and thanks for reading this wall of text.

Just got home and it's 2am but this sounds interesting and I will review it in the morning and get back to you with my thoughts :)

1 Answer

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Submitted a pull request to simplify the code a little.

Much obliged! :)