(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/** | |
* To run this script: | |
* npx tsx ./react-colocation-example-1.ts | |
*/ | |
// Product type | |
interface Product { | |
id: string; | |
price: number; | |
quantity: number; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
node: Platform built on V8 to build network applications | |
git: Distributed revision control system | |
wget: Internet file retriever | |
yarn: JavaScript package manager | |
python3: Interpreted, interactive, object-oriented programming language | |
python: Interpreted, interactive, object-oriented programming language | |
mysql: Open source relational database management system | |
coreutils: GNU File, Shell, and Text utilities | |
openssl: SSL/TLS cryptography library | |
postgresql: Object-relational database system |
// hell | |
function hell() { | |
step1(a => { | |
step2(b => { | |
return a + b | |
}) | |
}) | |
} | |
// heaven |
const data = [1,2,3,4,5,6,7,8,9,10,1,2,3] | |
const findDuplicates = (data) => { | |
const hashMap = {} | |
data.forEach((value) => { | |
hashMap[value] = (hashMap[value] || 0) + 1 | |
}) | |
return Object.entries(hashMap).reduce((acc, [value, nbOfItems]) => { | |
if (nbOfItems <= 1) { |
Card payments with Stripe should be performed with PaymentIntents.
This API was created to handle modern payments, where the cardholder's bank may require the user to authenticate themselves with the bank before a payment can be authorized.
Authentication requirements first started to appear with European banks regulated by PSD2 which introduced [Strong Customer Authentication
const getArrayCombinations = array => { | |
let combinations = [] | |
for (let i = 0; i < array.length - 1; i++) { | |
for (let j = i + 1; j < array.length; j++) { | |
combinations.push([ | |
{ | |
value: array[i], | |
position: i, | |
}, |
export const getNextQuarterHourFromDate = (date: Date) => { | |
const dateToReturn = new Date(date) | |
dateToReturn.setSeconds(0) | |
dateToReturn.setMinutes(Math.ceil(dateToReturn.getMinutes() / 15) * 15) | |
return dateToReturn | |
} | |
console.log({ | |
scenario: "getNextQuarterHourFromDate(new Date('1995-12-17T03:00:00.000Z'))", |
interface IComments { | |
id: number, | |
children?: IComments | |
parentId: number | null, | |
content: string | |
} | |
const nest = (items, id = null, linkKey = 'parentId') => ( | |
items | |
.filter((item) => item[linkKey] === id) |
var capitalize = function(value) { | |
return value.replace(/\b\w/g, function(match) { return match.toUpperCase(); }) | |
} |