Bateru - bateru.com - Learning is bateru

Latest News:

Code of the day: Javascript Flatten() 8 May 2013 | 09:34 am

/** * Returns an array that contains non-array elements. * If an element is an array, then the element is replaced by the content of the array. * @param{Array} * @return{Array} return null if no argum...

Google Go: recover() example 6 May 2013 | 08:24 pm

Here’s an example of how to use recover() in Google Go. package main import "fmt" func gandalf( doTalkTo bool ){ defer catch() if(doTalkTo){ // Panic stops execution of the current function and stops ...

Code of the Day: Filter a list of options using jQuery 11 Mar 2013 | 11:18 am

Here’s a common question when dealing with elements. Question from CodeReview.StackExchange.com Better Way to Filter Select List Here’s my answer. /** * Only shows options that contain a given text. *...

Code of the Day: Coffeescript + jQuery, enforce max length for all input elements 10 Mar 2013 | 12:59 pm

Enforce max length in all browsers since some browsers, IE8, don’t support maxlength for all input elements. Coffeescript # requires jQuery 1.6+ enforceMaxLength = -> $("[maxlength]").on "blur", -> $(...

Video of the day: 3d printing overview by OffBook PBS 5 Mar 2013 | 01:03 pm

Will 3D Printing Change the World?

Code of the day: Javascript check if an object is empty 5 Mar 2013 | 09:35 am

`isObjectEmpty()` is a function that will only return true if the passed an object that contains no keys. This is different than jQuery.isEmptyObject() because the passed argument MUST be an object. /...

Code of the Day: Javascript Auto-complete date format MMDDYYYY 4 Mar 2013 | 01:28 pm

/** * This function helps to autocomplete the date format MMDDYYY * Converts M to 0M and MMD to MM0D. Ex. `1/` to `01/`, `01/1/` to `01/01/` * Adds slash for MM and MMDD Ex. `01` to `01/`, `01/02` to ...

Re-implementation of Javascript’s Array.prototype.concat() 4 Mar 2013 | 01:11 pm

Just for fun I decided to see if I could write a faster version of `Array.prototype.concat()`. var concat = function (arr) { var args = arguments, len = args.length, ArrayTypeOf = "[object Array]", to...

Code of the Day: Chop up an array into groups using Underscore.js 13 Feb 2013 | 10:20 am

Shrink an array into a group of smaller arrays using underscore.js // Make sure to include underscore.js _.mixin({ chunk : function (array, unit) { if (!_.isArray(array)) return array; unit = Math.abs...

Tutorial – VIM in under 30 minutes 13 Nov 2012 | 08:09 am

“Vim is a text editor written by Bram Moolenaar and first released publicly in 1991. Based on the vi editor common to Unix-like systems, Vim is designed for use both from a command line interface and ...

Recently parsed news:

Recent searches: