How to console.log Moment.js version? - momentjs

Is there a way to find out what version of Moment.js is being used?
Moment.js

Simply use moment.version. It seems that this property is not mentioned in the docs page, but it is quite easy to get it looking at library code on github.
Here a live example:
console.log(moment.version)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>

Related

Which MathJax CDN script should be used?

I would like to use MathJax within my website, and I have opted to use a CDN method. MathJax.org states that you can put
<script
src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'>
</script>
within the HTML <head></head> tags and provided a pre-populated example on jsbin
However, I have noticed when using MathJax within WordPress, the MathJax documentation suggests using
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
I have noticed, that the difference is in the main part of the src address where the CDN used is cdn.mathjax.org instead of cdnjs.cloudflare.com, and the address points to mathjax/latest/MathJax.js instead of mathjax/2.7.2/MathJax.js.
I have put the second script into the jsbin example to see if there is a difference in function, and the example still works. Is it preferable (or more correct) to use the second script over the first one whether using WordPress or not, with the understanding that the second one will point to the most up-to-date version of MathJax?
As #Bob__ pointed out, and I had just read prior to then, MathJax was shutting down its CDN and they actually
retired cdn.mathjax.org in April, 2017.(Source: docs.mathjax.org)
The same webpage states that there are many free CDN providers that provide copies of MathJax. Some provide “rolling releases”, i.e., links that update to the latest available version upon release, and cdnjs.com is recommended. This matches Mathjax.org's page at https://www.mathjax.org/cdn-shutting-down/
They say
To jump start using cdnjs, you accomplish the first step by putting
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
into the <head> block of your document
Note: the configuration file TeX-MML-AM_CHTML is a great way test all input options at once. You can find leaner combined configuration packages in MathJax documentation.
Interestingly, before seeing that, carrying out a MathJax libraries search on cdnjs.com provides an updated script tag of
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js">
</script>
So the answer is to check for the latest library script tag in cdnjs.com, which is currently for version 2.7.3 and use that one. Currently
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js">
</script>
and if you wish to use the TeX-MML-AM_CHTML configuration file, use:
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

Routeboxer suddenly doesn't work

Does anybody know why suddenly Routeboxer does't seem to work?
I have tried to google it and it seems to be everywhere it doesn't work.
Ex:
http://googlegeodevelopers.blogspot.dk/2010/05/search-along-route-made-easy-with.html
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/routeboxer/docs/examples.html
Google Code was deprecated according to this:
http://google-opensource.blogspot.com.es/2015/03/farewell-to-google-code.html?m=1
You can find the libraries exported from the googlecode.com at:
https://github.com/googlemaps/v3-utility-library

MonoDevelop ASP.NET parser error using inline server tags inside html tag attribute

I've compiled monodevelop for mac, version 4.1.4(build 225) and while everything seems to work, I'm getting a parser error whenever I put a server tag inside an attribute of a html tag. For example, this works:
<span id='test'><%=DateTime.Now.Day.ToString()%></span>
But this returns the parser error
<span id='<%=DateTime.Now.Day.ToString()%>'>test</span>
I've used all the latest mono runtimes, and tried C# and VB.NET projects without success. Can anyone help me out ?
http://forums.xamarin.com/discussion/4287/bug-3588-nested-div-tags-throwing-parser-errors-in-html-documents
Xamarin studio seems to have the same problem as MonoDevelop. I updated both and they both broke around the same time (from memory)
The fix mentioned in the post is not in latest stable or even beta yet. I'm going to play with Alpha release, but otherwise seems you might have to go back to 4.01 from one of the comments here. Hope this helps somewhat though maybe way too late.
This issue has been resolved in MonoDevelop version 4.1.11

Javascript: Why if(false)?

I saw this in code. It blew my mind.
<% if (false) { %>
<script type="text/javascript" src="~/Scripts/jquery-1.3.2.js"></script>
<% } %>
This seems so patently illogical that it must be intentional. I can only assume that somehow this "came up", and somebody inserted this as a work-around. There are, of course, no comments.
Why would someone do this?
That's a trick to get Visual Studio to include the javascript Intellisense for jQuery without actually emitting the script to callers.
Here is an example from Scott Gu explaining it.
Intellisense in Visual Studio works for jQuery if you add that to every .aspx, .ascx file.
But instead of including it in every file it is included only in the masterpage.
Visual Studio parses the markup files and finds a reference to jQuery and then uses the provided intellisense on it.
You'll also need to add a vsdocs.js file into the project.
You can read more about it here.
if(false) is a quick and dirty way to comment out a bunch of code
is there another line of code that looks like
<script type="text/javascript" src="~/Scripts/jquery-min.1.3.2.js"></script>
or similar? My guess is whoever wrote this wanted to have an easy way to switch in the big jQuery file for debugging purposes
To comment out code.
ASP does not respect HTML comments, so some people will use this, not knowing that ASP has its own syntax for comments.
This is just like a comment, to do not execute the script.

Ext is not defined

I'm trying to implement a TinyMCE plugin with ExtJs, with a demo as example, found here: link.
This fails because I receive an "Ext is not defined" error in Firebug. I basically copied the example, I only used a newer version of Ext. First of all the css and scripts are included:
<link href="scripts/extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script src="scripts/extjs/ext-all.js" type="text/javascript"></script>
<script src="scripts/miframe/miframe-min.js" type="text/javascript"></script>
<script src="scripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js" type="text/javascript"></script>
<script src="scripts/ux/Ext.ux.TinyMCE.js" type="text/javascript"></script>
Firebug does not complain, all the scripts are found on the specified paths and are included.
Next I call the Ext function in the head of my aspx document,
<script type="text/javascript">
console.log("Ready...");
Ext.onReady(function() {
console.log("set...");
Ext.get("cmdOpen").on("click", function() {
console.log("GO");
var dlg = new Ext.Window({
//etc
</script>
The console.log("Ready...") shows up in the console, then the code breaks. There are four references to "Ext is not defined", in ext-all.js(), miframe-min.js(), Ext.ux.TinyMCE.js() and in the code in the .aspx file. (Default.aspx)
I did not alter any aspect of the included files, they are official releases.
Am I perhaps missing a statement somewhere? Or do I have to include other things still? I have honestly no clue.
Even when including ext-all(-debug).js, you still need to include the ext-base.js file before that, otherwise you will get the "Ext is not defined error". Not sure by your last comment if you are already past this or not, but I thought I would point it out. Please see this page for complete details on how your includes should be set up:
http://www.extjs.com/learn/Tutorial:HTML_Page_Setup
there is a firefox extension called "jsview", it allows you to see what scripts and css files are included on a page.
When navigating to the link you include at the top of your post and opening the ExtJs file, you'll notice that the example provided is using version 2.1 of the code.
The Ext.ux.TinyMCE v0.6 has a corresponding blog post here. You will notice that it specifically requires:
Firefox 2+, Opera 9+, MSIE 7
ExtJS 2.1
TinyMCE 3.1.0.1
Ext.ux.ManagedIframePanel
Be aware that when plugging in a newer versions of the TinyMCE or ExtJs libraries, there might (read will) be breaking changes that you will then have to resolve. You could try scrape the files directly from the example to ensure you have a working version.
If you choose to use ExtJs v3+, get the latest components:
1) ux.ManagedIframe has been maintained more recently and even upgraded for ExtJS 3.x here
2) Read through the ux.TinyMce thread and download the latest version. I think it's 0.7b. If you're still having problems, that's probably the best place to find answers.
copy the lib folder in your eclipse workspace`s exjts project folder and just give the relative paths, is should than work
Go to ExtJs website and make sure you download and included all the necessary files and IN ORDER,also using a newer version might break the code.
try it with simpler examples and only reference the ext stuff and see if it loads

Resources