Is it possible to calculate a color in a middle of a gradient? I only have two hex strings, and I want one in return. Answer This should work: It basically involves converting them to decimal, finding the halves, converting the results back to hex and then concatenating them.
Author: admin@master
Save json string to client pc (using HTML5 API)
I read few older thread about the same, but seen the file API changed a lot recently. My requirement is to save a json file (data is locally in indexdDB, but I need a way to back it up). Since I use indexdDB, I only target recent browsers, mainly chrome. So, it it possible to save data (json string) to
Three.js – Rotating a sphere around a certain axis
I have a problem. In Three.js, I want to rotate a sphere (Earth) around axis tilted by 23.5 degs. I found sphere.rotation.x, sphere.rotation.y and sphere.rotation.z, but when I combine them in the correct ratio, the sphere’s rotation is quite weird – it has no permanent rotation axis. I think I ne…
No events for dynamically generated input tags
I have dynamically generated some input tags for a web application. The appended elements do not seem to have associated click, select etc.. events. I read you can you .on(). I would like to associate all possible events to all types of elements in a general way. What is the best way to go about this? Answer …
Find centerpoint of polygon in JavaScript
I have a “place” object from Google Maps which has a set of coordinates that represent a bounding box for a given location, say London. Each set of coordinates has a latitude and longitude. I have written the below code to find the centerpoint, but I am not sure if it does actually produce the cen…
Get zoom size on Google Map API
How can I get the zoom size in google map after changing by mouse wheel or zoom bar ? I use Google Map API 3 with JavaScript. I want to show in console.log() with every change. Answer Easy. As per docs: Here’s a great utility that shows all the events as they fire.
Add class to li if content is a certain string
Would it be possible to add a certain class to a li that contains a certain string of text using JavaScript/jQuery? UPDATE/NEW QUESTION: Instead of detecting the content of the li, can I have it add the class if the li has another specified class? Answer Answering the fellow’s extended question: YouR…
Can anyone explain me what is state and mutable data?
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. http://en.wikipedia.org/wiki/Functional_programming Can anyone explain me what is state and mutable data? Can anyone give me examples in …
Creating a BLOB from a Base64 string in JavaScript
I have Base64-encoded binary data in a string: I would like to create a blob: URL containing this data and display it to the user: I haven’t been been able to figure out how to create the BLOB. In some cases I am able to avoid this by using a data: URL instead: However, in most cases the data: URLs
Converting Excel Date Serial Number to Date using Javascript
I have the following javascript code that convert date (string) to the Date Serial Number used in Microsoft Excel: So, how do I do the reverse? (Meaning that a Javascript code that convert the Date Serial Number used in Microsoft Excel to a date string? Answer Try this: Custom made for you 🙂