zjkuang Zhengqian (John) Kuang iOS Developer Regina, SK, Canada
I hereby claim:
- I am zjkuang on github.
- I am zjkuang (https://keybase.io/zjkuang) on keybase.
zjkuang Zhengqian (John) Kuang iOS Developer Regina, SK, Canada
I hereby claim:
// | |
// CombineCheatSheet.swift | |
// | |
// | |
// Created by Zhengqian Kuang on 2020-05-17. | |
// | |
import Foundation | |
import Combine |
// TypeScript Playground - https://www.typescriptlang.org/play | |
//////////////////////////////////////////////////////////////////////////////// | |
// Start multiple promises simultaneously and execute them in parallel | |
const p1 = new Promise((resolve) => { | |
setTimeout(() => { | |
const result = Date(); | |
console.log(`r1: ${result}`); |
function anyToString(a: any): string { | |
if (Array.isArray(a)) { | |
let s = '['; | |
const arr = a as Array<any>; | |
const numberOfElements = arr.length; | |
arr.map((e, index) => { | |
let eString = anyToString(e); | |
s = s + eString; | |
if (index + 1 < numberOfElements) { | |
s = s + ','; |
Visual Representation of SQL Joins | |
https://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins |
Sophie's Maths
In Terminal,
npx <url-of-this-gist>
IMPORTANT: If you have made any changes in the script, to make the changes visible, make sure you update the version number in package.json
In Termial, run
npx <url-of-this-gist>
Each time you make any change, remember to update the version in package.json
// Consider the "smallest" positive number in JavaScript, (where there are 322 zeros before "1" after the point,) | |
const a = 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; | |
// I call it "smallest" because if we add one more zero before the "1", JavaScript takes it as zero: | |
const a0 = 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; | |
console.log(`a0 == 0: ${a0 == 0}`); // true | |
// Now let's check a number b9, | |
// a = 0.0...01 // 0.(322 zeros)1 | |
// b9 = 0.0...009 |
// [1] | |
// [1,1] | |
// [2,1] | |
// [1,2,1,1] | |
// [1,1,1,2,2,1] | |
// [3,1,2,2,1,1] | |
// [1,3,1,1,2,2,2,1] | |
// [1,1,1,3,2,1,3,2,1,1] | |
// [3,1,1,3,1,2,1,1,1,3,1,2,2,1] | |
// [1,3,2,1,1,3,1,1,1,2,3,1,1,3,1,1,2,2,1,1] |