JavaScript: How to detect the browser currently used by the user?

Opera
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
At least Safari 3+: “[object HTMLElementConstructor]”
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;

Check if an input is a string or a url

In this scenario, we are not checking if this is a valid url but we just want to differentiate if it is a string or a url.

var str = 'winnieverzosa.com'
isURL(str);
function isURL(str){
	if ( str.match(/.*\..*/) ){
		alert(str + ' is a URL');
	} else {
		alert(str + ' is NOT a URL');
	}
}

jQuery Validate URL

function isUrlValid(url) {
    return /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url);
}

Install ffmpeg

add-apt-repository ppa:mc3man/trusty-media
Also note that with apt-get a sudo apt-get dist-upgrade is needed for initial setup & with some package upgrades
More info: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
Press [ENTER] to continue or ctrl-c to cancel adding it
sudo apt-get update
sudo apt-get dist-upgrade
apt-get install ffmpeg

http://www.faqforge.com/linux/how-to-install-ffmpeg-on-ubuntu-14-04/

Get all the methods in a class

By using the getMethods() function from ReflectionClass you are able to get all the methods in a class.

Simply create an object of the ReflectionClass with one argument, the class name you want to access. Then, use the getMethods() function and assign the result to a variable.

$class_obj = new ReflectionClass('myClass');
$array_of_methods = $class_obj -> getMethods();
var_dump($array_of_methods);

Check if the class method exists in PHP

You can simply use the built-in function method_exists() and it will return a boolean true if it exists and false if it doesn’t.

Example Usage:

$class_obj = new ClassName();
var_dump( method_exists($class_obj, 'myMethodName') );

Example Output:

bool(true)