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...
I was reading this article today on two different regular expression algorithms.    According to the article old Unix tools like ed, sed, grep, egrep, awk, and lex, all use what's called the Thompson NFA algorithm in their regular expresssions......
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?...
Let A be a list and S a sorted list of the same elements. Assume all elements are different. How do I find a minimal set of "moves" (move X before Y (or end)) that turns A into S?  Examples:  A = [8,1,2,3] S = [1,2,3,8]  A => S requires on...
Say I have two values 0 <= a < b <= 1, how can I chose an x such that a <= x<b with the shortest binary expansion possible?  My approach so far is to take the binary strings of a and b, with the decimal point removed, and at the first...
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....

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.