- Shall i implement it?
- No ...
| //adapted from the LoessInterpolator in org.apache.commons.math | |
| function loess_pairs(pairs, bandwidth) | |
| { | |
| var xval = pairs.map(function(pair){return pair[0]}); | |
| var yval = pairs.map(function(pair){return pair[1]}); | |
| console.log(xval); | |
| console.log(yval); | |
| var res = loess(xval, yval, bandwidth); | |
| console.log(res); | |
| return xval.map(function(x,i){return [x, res[i]]}); |
| Copyright (c) 2020- Juha Järvi | |
| Permission to use, copy, modify, and/or distribute this software for any | |
| purpose with or without fee is hereby granted. | |
| THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
| REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
| AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
| INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
| LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| /** | |
| * Sorts all arrays together with the first. Pass either a list of arrays, or a map. Any key is accepted. | |
| * Array|Object arrays [sortableArray, ...otherArrays]; {sortableArray: [], secondaryArray: [], ...} | |
| * Function comparator(?,?) -> int optional compareFunction, compatible with Array.sort(compareFunction) | |
| */ | |
| function sortArrays(arrays, comparator = (a, b) => (a < b) ? -1 : (a > b) ? 1 : 0) { | |
| let arrayKeys = Object.keys(arrays); | |
| let sortableArray = Object.values(arrays)[0]; | |
| let indexes = Object.keys(sortableArray); | |
| let sortedIndexes = indexes.sort((a, b) => comparator(sortableArray[a], sortableArray[b])); |
Converted via https://domchristie.github.io/turndown
Sublime Text/Merge 中文 Telegram 交流群組: https://t.me/sublime_tw
ST 4 is currently under private alpha for power users to test and report issues to let the dev team make it polished before it gets publicly announced. It has been under alpha for over 1 year already and it's actually kind of stable for daily use now. If you have a ST 3 license, you can join the offical ST Discord chat server to download and test it. And the most important thing, report issues you encoutered so ST 4 can become better. I hope people can interact with the dev team more so I don't directly put download links here but maybe you are smart enough to guess them :)
Dev Channel Changelog
| /* | |
| // binomial coefficient nCk | |
| function binom(n, k) { | |
| k = n - k < k ? n - k : k; | |
| const b = [1].concat(Array.from(Array(k), _ => 0)); | |
| for (let i = 1; i <= n; i++) { | |
| for (let j = i < k ? i : k; j > 0; j--) b[j] += b[j - 1]; | |
| } | |
| return b[k]; | |
| } |
This script generates random numbers along a Normal or Log-normal distribution using the Marsaglia polar method.
normalRandom: Generate random numbers that follow a Normal distribution.normalRandomInRange: Generate random numbers that follow a Normal distribution but are clipped to fit within a rangenormalRandomScaled: Generate random numbers that follow a Normal distribution with a given mean and standard deviationlnRandomScaled: Generate random numbers that follow a Log-normal distribution with a given geometric mean and geometric standard deviation
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
| Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
| ActivityTweet | |
| generic_activity_highlights | |
| generic_activity_momentsbreaking | |
| RankedOrganicTweet | |
| suggest_activity | |
| suggest_activity_feed | |
| suggest_activity_highlights | |
| suggest_activity_tweet |