Skip to content

Instantly share code, notes, and snippets.

@dmonder
dmonder / Chrome Onboarding - Pieces for Developers Snippet.md
Created March 18, 2024 21:11
A TypeScript function for deep cloning objects and arrays recursively.

Chrome Onboarding - Pieces for Developers Snippet

Preview:
const deepClone = (obj: any) => {
	if (obj === null) return null;
  let clone = { ...obj };

  Object.keys(clone).forEach(
	  (key) =>
 (clone[key] = typeof obj[key] === "object" ? deepClone(obj[key]) : obj[key])

Keybase proof

I hereby claim:

  • I am dmonder on github.
  • I am dmonder (https://keybase.io/dmonder) on keybase.
  • I have a public key ASBNhl33u2Bdopw36Fw10wGB_x5UkzQDrzp2zmsOOpTkuwo

To claim this, I am signing this object:

let func =
(SelectionList as list, ListOfPositions as list, optional StartWithOne as number, optional FillWithNulls as number) =>
let
selectionList = List.Buffer(SelectionList),
listOfPositions = ListOfPositions,
StartPosition = if StartWithOne = 1 then -1 else 0,
Result = {List.Transform(listOfPositions, each selectionList{_ + StartPosition}), // null
List.Transform(listOfPositions, each selectionList{_+StartPosition}?), // 0
@dmonder
dmonder / README.md
Last active January 2, 2020 16:53
Markdowns

Markdowns

This is a gist to store my general Markdown files.

@dmonder
dmonder / README
Last active January 2, 2020 16:46
R Snippets
Store R snippets for future use.
@dmonder
dmonder / index.html
Last active January 2, 2020 16:36
HTML Playground
<div>Hi, I'm GistPad!</div>