Difference between a thunk and a closure

I thought I knew what was a closure but I'm not so sure reading some article around react. Is the function below a "thunk" ? (for me it's a closure, I took this from a blog article about react https://spin.atomicobject.com/2016/10/05/form-validatio...
more »

2017-05-17 23:05 (2) Answers

ASP.NET Core WebAPI Security Considerations

My WebAPI is, just that, an API backend for my UI to consume. In fact, I will have perhaps 10's of WebAPI services that my UI will use. I'm having difficulty understanding what I need to consider in terms of security. My APIs are secured using Bear...
more »

2017-05-17 20:05 (1) Answers

Build a chain out of integer pairs

I have a set of integers pairs: [4, 3], [0, 1], [0, 4], [2, 3], [2, 1] The task is to chain it to get the output: [0, 1], [1, 2], [2, 3], [3, 4], [4, 0] Are there any existed optimised algorithms to do it? Cheers! ...
more »

2017-05-17 19:05 (1) Answers

An array mapping function

I have this chunk of javascript code: function arrayMapper(mappingFunc) { return items => items.map(mappingFunc); } function fooTransformer(tem) { return (...); // do something with item and returns a value } function barTransformer(tem) { ...
more »

2017-05-17 18:05 (2) Answers

ExtJS 6.5 class system

With the release of Sencha CMD and ExtJS 6.5 last week, I was very excited to use ES6 classes in my ExtJS projects. With this said, the only sort of 'documentation' I've been able to find that talks about how to implement ES6 classes in ExtJS was a t...
more »

2017-05-17 16:05 (1) Answers

How to get the tag text in this case?

I'm struggling to get the content of the tag <text> $( "svg" ).click(function(e) { console.log("we are in the svg element"); //console.log(e.target.next("text")); }); <script src="https://ajax.googleapis.com/ajax/libs/jquer...
more »

2017-05-17 12:05 (2) Answers

Change image src on the button when hover

I want to change my img src when I hover on the button. There are few answers that are similar to mine, but I still can't figure it out. <button class='Nav' id="Nav_Homepage"> <img src="./img/Homepage.png" class='img_Nav' id="img_Hom...
more »

2017-05-17 08:05 (3) Answers

Get tagname name value javascript

I'm trying to get the tagname of name from the below line of code. I have to get the name from the below tagname using javascript <preference name="webviewbounce" value="false" /> i need to get webviewbounce This is what i know. document....
more »

2017-05-17 06:05 (6) Answers

Mysterious mouse event closes jQuery UI dialog

This is obviously a SSCCE. So we are tasked with writing the front-end of a missile launch control system. We opt for a Spartan layout given that this is deadly serious: just a text input box and a button to enter the code: For safety purposes, u...
more »

2017-05-16 22:05 (2) Answers

is it valid to use global function in javascript?

I have a question about the global script, I'm using the following script right now since those functions are used globally on every page. (before I have the same functions like unit converter function defined in 8 places, now I move it to the global...
more »

2017-05-16 21:05 (2) Answers

Prevent label active state using javascript

I have a quite simple scenario where I am trying to prevent the orange background on mouse down: document.querySelector('label').addEventListener('mousedown', (event) => { console.log('mouse down') event.preventDefault(); }) label:ac...
more »

2017-05-16 21:05 (2) Answers

HighCharts Solid Gauge Chart not displaying ticks

Using Highcharts 5.0.11 .JS version and Solid Gauge. Page has two temperature Gauges which are going to be half crescent in shape. The first Gauge Internal Temperature is fine, but when trying to play with settings to create an inverse Gauge the char...
more »

2017-05-16 20:05 (1) Answers

How to refresh PHP scripted page with Javascript

How can I refresh echo using javascript? I have something like this: <?php $today = time(); $todayStr = date('D'); $summerS = mktime(0,0,0,2,0,date('Y')); $summerE = mktime(0,0,0,12,21,date('Y')); $close = mktime(17,0,0,date('n'),date('j'),date...
more »

2017-05-16 19:05 (1) Answers

How to deal with AdBlock blocking non-ad elements

I recently had an issue whereby a user was complaining that they couldn't access a certain page because the link wasn't where it was supposed to be. After some head-scratching, I had them disable all browser extensions and sure enough the problem we...
more »

2017-05-16 11:05 (1) Answers

JSON Sorting by Alphabetical Order

I am trying to output the JSON below to HTML. I ace created the object along with the properties for this object however, I am struggling to output this to HTML. Here is what I have so far. Any idea? var people; people = [{ first_name: '...
more »

2017-05-16 11:05 (2) Answers

How to flatten a nested forEach?

I have the following input: schema: [{ fields: [{ name: 'name', type: 'text', col: 10, value: '' }, { name: 'description', type: 'text', col: 2, value: '' }] }, { fields: [{ na...
more »

2017-05-16 04:05 (4) Answers