Skip to content

Instantly share code, notes, and snippets.

View hellatan's full-sized avatar

dale tan hellatan

View GitHub Profile
@hellatan
hellatan / optionalchaining-nullcoalescing.md
Last active June 10, 2021 16:41
optional chaining / nullish coalescing tanspilation

Try to assign the closest parent when using optional chaining. If the closest parent is not, then something like the following will be output:

// original - multiple defintions of a comment parent `viewer?.user?.curatedFolderActivity?.edges?.[0]?.node`
const elementId = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.serviceId;
const folderPk = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.serviceId;
const folderUrlLabel = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.name;
const repName = viewer?.userRelationships?.[0]?.userDataB?.[0]?.displayName;	
const imageSrc = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.firstItemImage || '';

outputs (scroll left -> right to see full output)

  1. Choose the commit to rebase up to (this will not include the commit in the rebase)
~/$ git rebase -i 4446727
  1. Depending on your editor, a screen with the following output will show up:
  1 pick bc1ecf1 test: start mock service in setup file
  2 pick ebc37e6 fix: use array destructuring, added type checking
  3 pick bda6e77 refactor: DRY object creation with locale
@hellatan
hellatan / brew-specific-node-version.md
Last active May 5, 2019 01:38
Commands for installing specific node.js versions via homebrew

tl;dr:

~/$ brew unlink node
~/$ brew install node@10
~/$ brew link node@10 --force --overwrite

full output:

~/$
==> Caveats
==> git
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
@hellatan
hellatan / q.md
Created February 3, 2016 16:00 — forked from SinisterMinister/q.md
JS Interview questions

Javascript Interview Questions

General interview questions for a front-end JS developer.

Questions

  • What is the spec Javascript implements and what versions of it are you most current with?

  • Does JavaScript support the use of classes?

@hellatan
hellatan / SassMeister-input.scss
Last active October 9, 2015 21:08
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
%application-header {
text-transform: uppercase;
font-family: "helvetica";
line-height: 1;
}
@hellatan
hellatan / SassMeister-input.scss
Created October 9, 2015 20:58
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
%application-header {
text-transform: uppercase;
font-family: "helvetica";
line-height: 1;
}
@hellatan
hellatan / SassMeister-input.scss
Created August 30, 2015 18:05
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
html {
box-sizing: border-box;
}
*,
*::before,
@hellatan
hellatan / deleteRemoteBranches.js
Last active August 29, 2015 14:03
Delete remote branches (typical context is github for me)
#!/usr/bin/env node
//DO NOT PUT "use strict" HERE OR THE LOGGER WILL NOT BE ABLE TO LOG ERROR
/*
1. node.js must be installed
2. added +x to this script
3. put this script anywhere, but run the shell command from within the desired repository
*/
@hellatan
hellatan / SassMeister-input.scss
Created April 19, 2014 20:53
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
%holder {
color: green;
&:hover {
color: red;
}
}