Javascript

Great article on Duck Typing in JavaScript

Great article on Duck Typing in JavaScript

Found a great article that explains what duck typing is and how it is used in JavaScript. Author makes it very simple to understand with examples. A style of typing in which an object’s methods and properties determine the valid semantics, rather than it’s inheritance from a particular class or implementation of an explicit interface. You can click on the link below to be redirected to that article. Duck Typing in JavaScript

How to create jaw dropping Data Visualizations on the web with D3.js?

How to create jaw dropping Data Visualizations on the web with D3.js?

Story telling using great visualizations. Thus article goes into the details of creating great visuals leveraging D3 JavaScript library. It introduces the user into concepts provided by the D3 library. Some of the steps includes: Refreshing previous concepts of D3.js A glance at advanced concepts: Scales, Axes and Reading data from external sources Building basic charts and code reusability Line Chart Area Chart Chart as a modular structure Case Study Visualizing Game of Thrones Social Network – Force Directed Graph in action!

Javascript: Embrace Arrow Functions

Javascript: Embrace Arrow Functions

Great article on JavaScript currying and arrow functions. Here is an example of a function in Javascript: const secret = function (msg) { return function () { return msg; }; }; The same function as currying or arrow function: const secret = msg => () => msg; To learn more about the basics, visit the link below. Source: Familiarity Bias is Holding You Back: It’s Time to Embrace Arrow Functions

Elements of JavaScript Style – JavaScript Scene – Medium

Elements of JavaScript Style – JavaScript Scene – Medium

Great article focusing on Javascript style. Provides some good examples of JavaScript coding styles, practices, and things to avoid. The examples includes: Make the function the unit of composition. One job for each function. Omit needless code. Use active voice. Avoid a succession of loose statements. Keep related code together. Put statements and expressions in positive form. Use parallel code for parallel concepts. Source: Elements of JavaScript Style – JavaScript Scene – Medium

Angular Modules vs ES6 Modules - DZone Web Dev

In this post, you’ll find a quick tutorial explaining the difference between Angular Module and ESG Modules, and how to best use each of these platforms. Here is a quick summary: ES6 Module Example: import { sqrt } from 'math-utils'; const addition = (val1, val2) => val1 + val2; const subtraction = (val1, val2) => val1 - val2; const multiplication = (val1, val2) => val1 * val2; const calculateSquareRoot = (val) => sqrt(val); export { addition, multiplication } Angular Module Example:

An insecure mess: How flawed JavaScript is turning web into a hacker's playground | ZDNet

Researchers say tens of thousands of sites are using JavaScript libraries that are years old and contain publicly known vulnerabilities. An analysis of over 133,000 websites has found that 37 percent of them have at least one JavaScript library with a known vulnerability. There are no reliable vulnerability databases, no security mailing lists maintained by library vendors, few or no details on security issues in release notes, and often, it is difficult to determine which versions of a library are affected by a specific reported vulnerability.

How to package your node.js application for deploying it in an offline environment?

Personally speaking, I prefer to have a self-contained bundle with all the artifacts and modules that might be required to deploy an application (not just Node.js application) in Production. In that way, I know exactly the bits that were installed and nothing more and nothing less. It also eliminates the availability of the NPM modules and network connectivity issues, etc. The following procedure shows you how to create a simple “Hello World” Node.

Copy to Clipboard - a browser agnostic way to script this functionality

Have you tried to present some code or sample content for the end-user that you wanted to allow them to easily copy to their clip-board? If you use the JQuery Javascript library then you can use the plugin called zClip available here - zClip Using zclip you can attach an event to a button or a text-area such that when the event occurs, the content is copied to the clipboard.

Importance of named windows and how to close all child windows

One of the questions posed by a friend of mine is this. In a typical website-application, you spawn a few child windows here and there and because of the nature of the application, you do not have a handle to all the child windows you spawn open... Then how do you close all the child windows that belong to your application when the user logs out of your application or closes the main window with the intent that he/she wants to log out?

jQuery Accordian Internet Explorer 6 Issue

If you are using the Accordian UI from jQuery and your accordion body (the content in div.ui-accordion-content tag) contains anchor tags then you might experience a few glitches in IE6 where the display might not render properly when selected. One way to address this issue is the following: Add this to the header… [sourcecode language=“jscript”] [/sourcecode] This will force a refresh of the content when expanded. The other thing that you may not have is a doctype defined in the header.