The regex should be (\/\/).*$ If you have a way to mark your useful comments. Like I have — to mark them, you can use it in the negative lookahead ( to filter only the unuseful comment ) (\/\/)(?! –) You can use this in IDE such as PHPSTORM
ARCHIVE
Javascript
The regex should be \/\/ .*$ You can use this in IDE such as PHPSTORM
Today I am going to show you format time from this format x ( seconds ) to xx:xx . And the reverse. Javascript function from 90 to 1:30 function formatTime(arg) { //formats the time var s = Math.round(arg); var m = 0; if (s > 0) { while (s > 59) { m++; s -=
Today we are going to learn how to integrate custom Google Analytics events in WordPress.
For example I will setup a component I have here.
Hello! I have a iframe shortcode generator inside of wordpress and I needed to get the wp uploader to insert media on it. Wheter you need it on a external page / frontend / whatever, this is the tutorial for you. First we need to load WordPress in our file. If it’s the frontend you
add_query_arg function add_query_arg(purl, key,value){ key = escape(key); value = escape(value); var s = purl; var pair = key+"="+value; var r = new RegExp("(&|\?)"+key+"=[^&]*"); s = s.replace(r,"$1"+pair); //console.log(s, pair); if(s.indexOf(key + '=')>-1){ }else{ if(s.indexOf('?')>-1){ s+='&'+pair; }else{ s+='?'+pair; } } //if(!RegExp.$1) {s += (s.length>0 ? '&' : '?') + kvp;}; return s; } get_query_arg function get_query_arg(purl, key){

This jQuery plugin should calculate the textwidth of elements. jQuery.fn.textWidth = function(){ var _t = jQuery(this); var html_org = _t.html(); if(_t[0].nodeName=='INPUT'){ html_org = _t.val(); } var html_calcS = '' + html_org + ''; jQuery('body').append(html_calcS); var _lastspan = jQuery('span').last(); //console.log(_lastspan, html_calc); _lastspan.css({ 'font-size' : _t.css('font-size') ,'font-family' : _t.css('font-family') }) var width =_lastspan.width() + 5; //_t.html(html_org); _lastspan.remove();
Recent Comments