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
au FileType gitcommit setlocal tw=72 |
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
{ | |
"files.autoSave": "onFocusChange", | |
"editor.formatOnSave": true, | |
"workbench.activityBar.visible": false, | |
"editor.quickSuggestions": { | |
"other": false, | |
"comments": false, | |
"strings": false, | |
}, | |
"window.openFoldersInNewWindow": "on", |
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
package leet.unionfind; | |
import java.util.*; | |
public class EvaluateDivision { | |
public double[] calcEquation(List<List<String>> equations, | |
double[] values, List<List<String>> queries) { | |
// <node, parent of the node> | |
Map<String, String> parent = new HashMap<>(); |
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
import React, { Fragment, useState, useEffect } from 'react' | |
const Timer = ({ minutes, classNames }) => { | |
if (!minutes) return null | |
const [seconds, setSeconds] = useState(minutes * 60) | |
useEffect(() => { | |
let timeout = setInterval(() => { | |
setSeconds(seconds - 1) |
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
if [ -f ~/.git-completion.bash ]; then | |
. ~/.git-completion.bash | |
fi | |
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then | |
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share | |
GIT_PROMPT_ONLY_IN_REPO=1 | |
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" | |
fi |
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
[alias] | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
myrebase = !git add -A && git commit --amend --no-edit | |
mycommit = "!git add -A && git commit -m " | |
myrank = "shortlog -n -s --no-merges" | |
pullm = "pull origin master" | |
[color] | |
branch = auto | |
diff = auto | |
status = auto |
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 makeAPIRequest(url, timeout = 2000, headers) { | |
// Some code to fetch data | |
console.log('url ', url) | |
console.log('timeout ', timeout) | |
console.log('headers ', headers) | |
} | |
makeAPIRequest("/api", undefined, {"head": "ers"}) | |
// url /api |
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
/* | |
ref: https://scotch.io/@devGson/understanding-iterators-and-iterables-in-javascript | |
*/ | |
let obj = { | |
start : 1, | |
end : 5 | |
}; | |
//for..of initially calls this method |
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
// 1. constructor invocation pattern | |
// uses the new operator to create instance | |
function Person(name, gender) { | |
this.name = name; | |
this.gender = gender; | |
}; | |
const adam = new Person('Adam', 'male'); | |
console.log(adam); // Person { name: 'Adam', gender: 'male' } |
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 Foo(y) { | |
this.x = 10; | |
this.y = y; | |
this.calculate = function(z) { | |
// console.log(this); // prints the Foo instance | |
return this.x + this.y + z; | |
} | |
} | |
let fooIns = new Foo(20) |
NewerOlder