Gulp – Target all files in a folder and its subfolders

It’s supposed to match any number of subdirectories: ** If a “globstar” is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does not crawl symlinked directories. https://github.com/isaacs/node-glob Do you have symlinked directories in there? Symlinks I don’t think you’ll get gulp to natively traverse your … Read more

Uncaught TypeError: .indexOf is not a function

Basically indexOf() is a method belongs to string(array object also), But while calling the function you are passing a number, try to cast it to a string and pass it. document.getElementById(“oset”).innerHTML = timeD2C(timeofday + “”); var timeofday = new Date().getHours() + (new Date().getMinutes()) / 60; function timeD2C(time) { // Converts 11.5 (decimal) to 11:30 (colon) … Read more

imitate browser zoom with JavaScript

There you go: Use: document.body.style.zoom=1.0;this.blur(); 1.0 means 100% 150% would be 1.5 1000% would be 10.0 this.blur() means that the curser, maybe you selected an input field, looses focus of every select item. or: You can use the css3 element zoom (Source) Firefox does not allow zooming with the browser because you can’t access the … Read more

vue.js v-for list not updating

Array change detection is a bit tricky in Vue. Most of the in place array methods are working as expected (i.e. doing a splice in your $data.names array would work), but assigining values directly (i.e. $data.names[0] = ‘Joe’) would not update the reactively rendered components. Depending on how you process the server side results you … Read more

Does the order of Babel 6 presets matter?

From babeljs.io/docs/plugins: (as of 9/30/2016) Plugin/Preset Ordering Ordering matters for each visitor in the plugin. This means if two transforms both visit “Program”, the transforms will run in either plugin or preset order. Plugins run before Presets. Plugin ordering is first to last. “plugins”: [ “transform-decorators-legacy”, // will run first “transform-class-properties” // will run second … Read more

Detect if an alert or confirm is displayed on a page

If you wanted to run some code when an alert() fires, you could try something like this: I’ve only tested in Chrome, so I’m not sure about browser support. Example: http://jsfiddle.net/Q785x/1/ (function() { var _old_alert = window.alert; window.alert = function() { // run some code when the alert pops up document.body.innerHTML += “<br>alerting”; _old_alert.apply(window,arguments); // … Read more

HTML5 Canvas pie chart

Even after searching Google and triple-checking my radians values, etc. I was still having trouble with this, so I have created a jsFiddle for people to play with as a live example and will post the code below as well. (Update: in the fiddle v2, stroke and labels are added also.) var canvas = document.getElementById(“can”); … Read more

Add onclick event programmatically

But keep in mind that addEventListener is supported in IE just from version 9. To support older versions of IE you could use something like that: if (element1.addEventListener) { // all browsers except IE before version 9 element1.addEventListener(“click”, CalCal, false); } else { if (element1.attachEvent) { // IE before version 9 element1.attachEvent(“click”, CalCal); } }