Lately I've been working on a project that requires tasks to be ran on user-scheduled intervals through node. We were receiving the schedules in a cron format and needed a node library that could handle scheduling the tasks and running them, even if the next iteration of the schedule was a long time away (the maximum potential amount of time a user could schedule between tasks was approximately 366 days, rounding up).
The first node library I investigated was node-schedule. Node-schedule is a scheduling library for node (who'd have thunk it) that is built for similar purposes to what I had in mind. It only had a couple problems... One of the problems was that it basically only uses setTimeout/setInterval in node, both of which have a maximum duration of about 24 days, which is far less than a possible time of 366 days. Another problem was that there was no real way to have node-schedule pass in arguments for you, unless you went to changing the library.
I didn't really want to modify the library because I figured it would be much simpler to just write my own, without all of the extra stuff node-schedule allows (human-like times, for example).
The birth of a new library
Thus, node-crontab was born. Node-crontab was built to be a small library that emulated crontab in node. It requires only two parameters, the first of which is a cron-syntax schedule and the second a callback function, and it handles everything else for you (most importantly, perhaps, it manages events scheduled for far-off dates automagically). It also has a few extra parameters that allow you to pass in arguments for your function, and even allows you to give your function context.
This was my first time writing a node library, so I got to learn about some cool stuff like publishing to npmjs and writing tests in mocha. I even set up travis-ci to auto-test pushes.
So, in the end, I got to learn a bit about node, while also making something I actually needed.
Fork me on Github!
Node-crontab is publicly available on Github, so fork it if you want. I tried to make the code not-entirely-terrible, and there's even some tests for it!
Also, there's code examples on Github, which makes it a lot less dry than this blog post.
Magic Table is a jQuery UI widget that converts normal HTML tables into interactive tables that can be filtered or sorted. That's pretty much all there is to it.
I also tried to make it so that you can easily modify how it looks using its CSS file. Originally, I intended the rows to be able to be converted into different things - that's why I used jsRender and pull in the rows template through $.get.
Why'd I make it?
Practice. I wanted to practice making a jQuery UI widget, and this was what I made. I was looking at Data Tables and couldn't find a way for it to have individual filters for each column, so I thought I'd give it a shot and make a widget for it. It turned out pretty nice, and does almost everything I originally intended for it to do.
Well, clearly, jQuery and jQuery UI are two major dependencies since it's a jQuery UI widget. It also relies on jsRender for the template rendering on the rows of the table.
One major downside to Magic Table is that it cannot be tested without a server. This happens because of how I used jsRender and used jQuery to pull in the rows file dynamically. The browser will not let you pull in files locally. It wouldn't actually take much effort to fix this, though.
Fork me on Github!
I've made the source for Magic Table available on Github. If Magic Table interests you, feel free to play with it. Have improvements? Make a pull request!
What is it?
What's it made with?
Honestly, we knew the game would be rushed so everything we did would have to be pretty simple to implement and test. For this reason, and the fact that I had been playing with HaxePunk a lot already lately, we chose HaxePunk. Along with HaxePunk, we used Nape as a physics engine and Tiled as a map editor. With this combination, we created Do No Harm and released it to the world as our entry in the Indie Speed Run.
There were a lot of challenges. We spent a lot of time up working on the game. It was probably one of the longest weekends of my life. Here's some of the finer points:
- None of us are graphically inclined. Almost all of our sprites came from either Caleb or Ben. The only sprite that wasn't made by us was the character sprite sheet, which we found on Open Game Art with a public domain license.
- Not very much time. We simply didn't have enough time to do everything we wanted to. Notice how the game doesn't have a story? There was one planned out, and it wasn't half bad, but we didn't have enough time to implement NPCs that tell it.
Can I play?
Yes, you can. You can play on the official Indie Speed Run website, located here. Make sure you hit "play game" after you load the page, the thumbnail looks like the game after it loads, so people often mistake it for the game and get upset when it won't start...
Welcome to Lots of Projects. Lots of Projects is a site I'll use to post about all of the random projects I start (and will probably give up on). It's also a place where I'll talk about whatever I want. So it's pretty much a blog and showcase at the same time.
This site has been around a while and I haven't worked on it much at all, but I'm working on it now and hopefully I'll keep it up.
So thanks for checking it out and I hope you'll come back!