Chart.js

I haven’t updated the blog in a while I know!

I was going to write a nice piece on new company, new developments, but that’ll have to wait for another day.

For now a lightweight charting library that’s just hit version 1. Chart.js

Includes Line, Bar, Radar, Polar Area, Pie and Doughnut which should be enough for most projects. The best bit is you can only include the js for the charts you actually use, making it even lighter.

Karma

I have recently started using Karma a test runner for JavaScript that runs off Node.js.  It then tests your JavaScript using a testing framework, like Jasmine, in a real browser!

karma
The YouTube video does a great job explaining what it does, and how to use it. They changed their name from Testacular, so that’s why they keep mentioning it in the video.

The best feature in my opinion is the watching of your JavaScript source, so as soon as you save a .js file in sublime, the test runs in your console. Instant feedback on what you’ve broken!

slick – responsive carousel

The carousel everyone’s talking about at the momentslick. A very nice looking responsive carousel with touch events, items, fading, add + remove and more.

slick

Looks good for a featured items, homepage slider and video list. I’d probably still use fotorama for image galleries, because of the large options for thumbnails and other more imagey specific things.

Prestashop 1.6

Prestashop 1.6 has been released!

I’ve upgraded my demo shop –http://mz-design.co.uk/testshop1.5/ to version 1.6 which does somewhat contradict the domain name. First problem though!

Prestashop 1.6 needs more memory for the backend to function. I have my FCGI PHP set to a default maximum of 32mb which gets exhausted. You will get an error such as..

Allowed memory size of 33554432 bytes exhausted (tried to allocate x bytes)

You will need to increase the maximum memory size, 32mb is quite low now-a-days. Increasing it to 64mb works nicely.

The admin interface is very nice, responsive and modern. A much needed upgrade. Its very rare for an open source eCommerce solution to have such a nice interface.

I will be testing all modules and making sure they all work nicely on Prestashop version 1.4 – 1.6

ifvisible.js

Some cool code to pause videos, ajax requests, and other things unnecessary when the page is inactive. ifvisible.js – Such as when the user is on another tab or goes AFK

Easy to hook onto events such as going idle and waking up. Would definitely recommend for projects, great to reduce processing overheads and lower bandwidth use when ajax calls are not needed.

TextQL

TextQL lets you perform SQL against flat text files like CSV. Perfect for extracting data from massive CSV files.

It seems to convert the CSV into a SQL lite database on the fly, allowing lovely SQL access and keeping the console interface which means unix pipes!

Now I just need an excuse to properly test it out.

Gulp.js

After starting to develop my own Grunt plugins and using it for all my new projects, a new build system appears. Gulp.js

Not only is the configuration easy to read, and more logically grouped with build items. For example all the thing you do with JavaScript are together, concatenation, minification and linting.

It uses piping (streams), which is one the most powerful features on Node.js. Allowing you to pipe outputs around different plugins without having to continuously having to write and move around files.

It is also faster than Grunt due to it not writing as many files. There are 237 plugins available at the time of publish, which is great for a build system that’s only recently getting the attention it deserves.

The next project I setup I’ll be testing out Gulp.

Faker.js

I’ve sneakily changed the ‘code of the week’ to ‘code of a week’. I initially did every week to fill up the blog with some content to get it going, I feel there’s enough content now. So I will only add my favourite code when I discover them, whenever that may be.

Anyway, I am getting into authentic automated testing. I prefer to have real life tests rather than code base automated testing, – so using Phantom / Casper JS. I believe it swings the testing further towards real life than automated server side tests. I see cases in complex server side processing where server side test frameworks are essential, but for mainly customer facing web applications Casper works brilliantly.

To further increase the realism of the tests, Faker.js allows you to generate random fake data. Such as names, addresses and many more. Using this and Casper JS makes a very nice real tests.

The mystery of the removed Prestashop Stripe module – Solved

Download and Latest updates – Stripe Prestashop Module

Updated – The module was removed because the contract with Stripe has expired, scroll to the bottom for more info.

I recommended Stripe to a client a mere month ago, safe in the knowledge that adding Stripe would be easy. There’s am official module available for free, it just needs installing an setting up, no problem.

But this weekend, I wander over to the Prestashop website, and absolutely no sign of the module, anywhere. Did I dream it? I searched Google, found many a reference to the module in the forums, but all links just went to the Prestashop Addons homepage. Maybe it was a free module that someone released, but has since removed? I then found a interesting post, someone said they had Stripe in an earlier version of Prestashop, but not the latest. It most have been included in core Prestashop as a ‘partner module’.

Happily, Prestashop use Github to store their code. We can look at the commit history to see what happened.

Stripe Removed

 

That is, on the 27/12/13 the Stripe module was removed from the ‘Partner Modules’ – The modules that are already there on a Prestashop install.

So.. Why was Stripe removed from Prestashop? The commit message gives no clues. The module doesn’t appear on their site anywhere else, and there has been no official announcement, even the forum moderators are confused.

The industry partners page (http://www.prestashop.com/en/industry-partners/payment/stripe) has been removed, redirected to their Payments page. – It seems PayPal who were a long time partner has also been removed. Have these contracts expired?

As it was on Git, I simply had to go back another commit to find the module, on version 0.9.7. I have added this to GitHub repository here – https://github.com/franksmule/prestashop-stripejs, and made an easy to use download link here -> Download Prestashop Stripe Module 0.9.7

I have checked the license, and I am allowed to redistribute this code under the Academic Free License.

I have asked on the Prestashop forums, why the module has been removed.

Thanks to Xavier for the response (Below, in comments). As he confirms, that contracts have not been renewed, so please enjoy the module above.

Code of the week – jQuery Plugin Pattern

I’ve developed jQuery plugins using a few different styles, but the one I’ve settled on and is currently my favourite is ‘jquery-plugin-pattern‘.

It gives you a very structured start that will help you avoid bugs, and quite importantly for me, be able to call plugin functions from outside the plugin without polluting the global namespace.

For example $('#my-id').plugin('doSomething', var1); instead of $('#my-id').doSomething(var1);.