Short-circuit? | Short-circuits on? | Fulfilled on? | Rejected on? | |
---|---|---|---|---|
Promise.all | Yes | First rejected promise | All promise fulfilled | First rejected promise |
Promise.allSettled | No | N/A | Always | N/A |
Promise.race | Yes | First settled | First promise fulfilled | First rejected promise |
Promise.any | Yes | First fulfilled | First promise fulfilled | All rejected promises |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Descendant selector: You can use a space to denote a descendant selector. This matches all elements which are descendants of a specified element. | |
Child selector: Use a greater than symbol (>) to select all elements that are immediate children of a specified element. | |
Adjacent sibling selector: Use a plus sign (+) to select all elements that are adjacent siblings of a specified element. They must have the same parent and immediately follow this element. | |
General sibling selector: Use a tilde (~) to select all elements that are siblings of an element. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Static: the default positioning of HTML elements. | |
Fixed: Element is positioned relative to the viewport and stays in the same place even if the page is scrolled. It’s also removed from the document flow. So elements in the DOM pretend like it’s not even there! | |
Relative: Element is positioned relative to its normal position. | |
Absolute: Element is positioned relative to the nearest relatively positioned ancestor. If no ancestor with position of relative is found, the element positions against the document body. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ComputeSMA(data, window_size) | |
{ | |
let r_avgs = [], avg_prev = 0; | |
for (let i = 0; i <= data.length - window_size; i++){ | |
let curr_avg = 0.00, t = i + window_size; | |
for (let k = i; k < t && k <= data.length; k++){ | |
curr_avg += data[k]['price'] / window_size; | |
} | |
r_avgs.push({ set: data.slice(i, i + window_size), avg: curr_avg }); | |
avg_prev = curr_avg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function trainModel(inputs, outputs, trainingsize, window_size, n_epochs, learning_rate, n_layers, callback){ | |
const input_layer_shape = window_size; | |
const input_layer_neurons = 100; | |
const rnn_input_layer_features = 10; | |
const rnn_input_layer_timesteps = input_layer_neurons / rnn_input_layer_features; | |
const rnn_input_shape = [rnn_input_layer_features, rnn_input_layer_timesteps]; | |
const rnn_output_neurons = 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
class Tokenizer { | |
constructor(config = {}) { | |
this.filters = config.filters || /[\\.,/#!$%^&*;:{}=\-_`~()]/g; | |
this.lower = typeof config.lower === 'undefined' ? true : config.lower; | |
// Primary indexing methods. Word to index and index to word. | |
this.wordIndex = {}; | |
this.indexWord = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
🎉 All free or open source.
Note: Updated for 2022-24+
If you want resources offline to learn about programming and web technologies MDN is for you! and I recommend to use MDN over w3school because w3school is outdated.
Download it offline (2.1gb) at https://mdn-downloads.s3-us-west-2.amazonaws.com/developer.mozilla.org.tar.gz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// form_container.js | |
import { connect } from 'react-redux'; | |
import { ReduxControlledComponent } from './components'; | |
const mapStateToProps = (state) => { | |
return { | |
name: state.name, | |
email: state.email, | |
password: state.password | |
} |