To reload or rerender the page using AngularJS you can use the snippet below.
Sample AngularJS
$route.reload();
To reload or rerender the page using AngularJS you can use the snippet below.
$route.reload();
To check if an array contains a value in Javascript you can use the snippet below.
Array.prototype.inArray = function (inputValue) { var counter; for (counter=0; counter < this.length; counter++) { if (this[counter] === inputValue) { return true; } } return false; };
To disable comments on posts older than date X in WordPress you can use the snippet below.
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2013-01-01' AND post_status = 'publish'
To delete all unapproved comments in WordPress you can use the following snippet.
DELETE FROM wp_comments WHERE comment_approved = 0
To remove any post that is older than X days in WordPress you can use the query below.
DELETE FROM wp_posts WHERE post_type = 'post' AND DATEDIFF(NOW(), post_date) > X
To show or hide a variable if null in AngularJs, you can use the snippet below.
<div ng-show="myVariable == null"></div>
or
<div ng-show="myvar != null"></div>
To disable or enable Trackbacks and Pingbacks in WordPress you can use the following mysql queries.
enable
UPDATE wp_posts SET ping_status = 'open';
disable
UPDATE wp_posts SET ping_status = 'closed';
To identify unused tags in WordPress you can use the following snippet.
SELECT * From wp_terms terms INNER JOIN wp_term_taxonomy tax ON terms.term_id=tax.term_id WHERE tax.taxonomy='post_tag' AND tax.count=0;
To resize a image proportionally with CSS, simply set either width or height to auto. This should also work if the img html tag has width and height attributes set.
img.resize{ width:200px; height: auto; }
To get or set the value of a textbox using jQuery you can use the following snippet.
$("#myTextField").val() //get $("#myTextField").val("newValue") //set