Skip to content

Author: admin@master

How do i find and count unique values in nested JSON objects?

i have the following JavaScript What i am trying to accomplish is when the order comes through a function scans the JSON and creates an array with each unique product name and adds 1 to the quantity each time. i have tried using a for loop but it loops it the amount of times but doesn’t find the name an…

Increase performance for 10,000 particles in HTML5 Canvas

I have two JS Fiddles, both with 10,000 snow flakes moving around but with two different approaches. The first fiddle: http://jsfiddle.net/6eypdhjp/ Uses fillRect with a 4 by 4 white square, providing roughly 60 frames per second @ 10,000 snow flakes. So I wondered if I could improve this and found a bit of i…

Need a RegExp to filter out all but one decimal point

I’m using the following code to negate the characters in the regexp. By checking the inverse, I can determine if the value entered is correctly formatted. Essentially, any digit can be allowed but only one decimal point (placed anywhere in the string.) The way I have it now, it catches all numerals, but…

How to await the ajax request?

I am trying to write a JS code that will cancel the “btn_submit” buttons .onclick event if the given number already exists in the database. I use AJAX to query the DB for the given number and to determine if the should send the data to a .php site which will upload the question. To determine this …

Port Knocking UDP with Javascript in Browser

So I am trying to send a port knock sequence from javascript. The TCP part is simple enough with websockets. I’ve read that WebRTC is the closest thing the browser offers to sending a UDP packet… but WebRTC is a lot to digest just to attempt to send a UDP “knock”. Is it even possible t…