Gaurav Sharma


Directive Priority in AngularJS

Recently I discovered that every directive in AngularJS has a priority score assigned to it. While the page is loaded the priority plays a very important role in setting the order of the execution of various directives in single DOM Element. The priority is used to sort the directives before their "compile" function gets called. In simple...



Replace All using JQuery and Regex

I recently found out that use of Regex with jQuery and replace function can turn out to be a very powerful tool for replacing/loading data in html dynamically The use of replace is made like [js] var a = "Some text here text"; a=a.replace(/text/g,"one") [/js] This will replace all "text" with "one" Now...



Clear Time function for MySQL

Hi all, Here is a simple function that can allow you to clear time from the DATETIME field of your database table [sql] DROP FUNCTION IF EXISTS cleartime; delimiter // CREATE FUNCTION cleartime(dt datetime) RETURNS DATETIME NO SQL DETERMINISTIC BEGIN DECLARE t varchar(15); -- the time part of the dt ...



Alphanumeric Sorting using Criteria Query (with MySQL database)

I am working on a Grails application with MySQL database. I had a use case in which I had to implement alphanumeric sorting using Criteria Query on Grails. By alphanumeric sorting I mean if there is a class Employee with field empId then on doing : [plain] Employee e1 = new Employee(empId:'emp10').save() Employee e2 = new...