Speech Recognition with Chrome

There are loads of posts online about Speech Recognition* but we have been having so much fun with it we wanted to highlight how easy it is to use.

*Compatibility is a big issue for any client work as it only really works in Chrome…

// Setup browser Speech Recognition
window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var recognition = new SpeechRecognition();
recognition.interimResults = true;
recognition.lang = 'en';

// Event listener for Speech results
recognition.addEventListener('result', function(event) {

// Add Speech Recognition results to var
var transcript = event.results[0][0].transcript;

// Display results in DOM
document.querySelector('.content').textContent = transcript;

}, false);

// Start speech recognition

// Event listener to restart speech recognition each time user has stopped talking
recognition.addEventListener('end', recognition.start);

For a full list of setting see: https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition

Bulk optimize your images with smush.it

PageSpeed Insights by google told me to “Optimize images [by] Properly formatting and compressing images [to] save many bytes of data.

Download the zip then in terminal run:

java -jar /path/to/your/smushit.jar -imageDir=/path/to/your/images

Download: https://github.com/abhirama/smushit/
Source: http://gizmotronix.com/losslessly-compress-a-batch-of-images-with-smushit/