I have lots of notes in my local files and also I plan to move them to gists.
// TODO: improve&refactor
// symfony convert request body to array:I have lots of notes in my local files and also I plan to move them to gists.
// TODO: improve&refactor
// symfony convert request body to array:| /* | |
| * searching some values in mysql is not as easy as you think | |
| * some search may not work way you think | |
| * for example, it's virtually impossible to search NULL values | |
| * without `IS NULL` | |
| * | |
| * you can test this queries using your local mysql or online services like sqlfiddle | |
| * | |
| */ |
| // special Javascript values | |
| const specials = [null, true, false, undefined, NaN, 1/0, -1/0, -0]; | |
| function getMixValue(){ | |
| return randIndex([ | |
| randSpecial, | |
| randInt, | |
| randFloat, | |
| randStr, |
Some notes about conversion to number in javascript
javascript has lots of methods to convert any value to number
all native methods behave the same way, sometimes with additional transform
| some esoteric ES6 functions | |
| var getDiagonalMatrix = N=>Array(N).fill(0).map((x,i)=>Array(N).fill(i).map((x,j)=>i==j?1:0)); | |
| var getNDArray = (N, x)=>N.length?(Array(N[0]).fill(0).map(()=>arr(N.slice(1),x))):x; | |
| var toBase = (x,n,r=[])=>x ? toBase(Math.trunc(x/n), n, [ x%n, ...r]):r; | |