What's a fast way to test if 2 rectangles are intersecting?    A search on the internet came up with this one-liner (WOOT!), but I don't understand how to write it in Javascript, it seems to be written in an ancient form of C++.  struct {...
It must be noted here that I performed the mathematics by hand on paper to derive the foregoing proofs. I am not sure if the proofs would have become apparent by solely using the medium of the modern computer.  The definition of "efficiency"...
Given  let doAsynchronousStuff = () => {   return new Promise(resolve => {     setTimeout(() => {       resolve("abcdefg"[Math.floor(Math.random() * 7)])     }, Math.PI * 1 + Math.random())   })   .then(data => console.log(data))...
There are many situations in parsing user input where the user has the opportunity to add several optional flags to the input which should be accepted in any order. How can this be parsed with regex so that each flag will be in it's own capture g...
Suppose you have to write a program that will test all programs in search of one that completes a specific task. For example, consider this JavaScript function:  function find_truth(){     for(n=0;;++n){         try {             var fn = Function(st...
Is there a jQuery plugin or javascript library that supports a "genie" animation effect like the apple Mac OS X dock?  Bonus: Actionscript library? C/C++? .NET? Objective C?...
Changing hue, saturation and lightness in HSL color space if very easy. See this javascript implementation for example.  It is also easy to generate color schemes like: analogous, monochromatic, triad, tetrad, etc. See this javascript implementation....
To avoid all standard-answers I could have Googled on, I will provide an example you all can attack at will.  C# and Java (and too many others) have with plenty of types some of ‘overflow’ behaviour I don’t like at all (e.g type.MaxValue + type...
Why do programming languages have a NaN value?  Math.floor('string');  //--> NaN   Why not just throw a TypeError?  TypeError: Expected number instead of string   The question is tagged both javascript and language-agnostic because JavaScr...
I'm looking for a efficient searching algorithm to get the longest shortest repeated pattern in a collection (~2k of integers), where my collection is made of this repeated pattern only (there is no noise between repeated patterns), but the last...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.