moved to main dotfiles repository.
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
SELECT schemaname,relname,n_live_tup | |
FROM pg_stat_user_tables | |
ORDER BY n_live_tup DESC; |
Git is a command line application, meaning it's an application that we run in the terminal / command prompt.
The purpose of git is to keep track of our works. As a programmer, what we usually do at work is write code. With git, we can see what are the things that we added, edited, or removed from our project's source code.
By default, git doesn't just track everything we do to our source code. Therefore we need to tell git which changes we made to the source code that we want to keep track later, as we discuss later.
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
// convert FormData to Object | |
export const fd2obj = (fd) => Array.from(fd.entries()).reduce((acc, i) => Object.assign({}, acc, { [i[0]]: (acc[i[0]] || Array.isArray(acc[i[0]])) ? [].concat(acc[i[0]]).concat(i[1]) : i[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
import { withStateHandlers } from 'recompose' | |
import { ReactNode } from 'react'; | |
type Ref = ReactNode | |
type RefsState = {} | |
type RefsHandlers = { | |
setRef: (fieldName: string, ref: Ref) => undefined | |
focusRef: (fieldName: string) => undefined | |
} | |
export type RefsProps = RefsHandlers & RefsState |
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
[ | |
{ | |
"name": "Afghanistan", | |
"number": "93", | |
"code": "AF" | |
}, | |
{ | |
"name": "Albania", | |
"number": "355", | |
"code": "AL" |
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 {readFileAsUrl} from './readFileAsUrl' | |
class Example extends React.Component { | |
constructor() { | |
this.state = { | |
previewUrl: '' | |
} | |
} | |
render() { | |
return ( |
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
/* | |
* convert ojbect into query params format | |
* used for request with content-type application/x-www-form-urlencoded | |
* | |
* e.g | |
* { param: "someVal", param2: "otherVal" } | |
* | |
* is converted into | |
* | |
* param1=someVal¶m2=otherVal |
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 you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="robbyrussell" |
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
const capitalize = (s) => s.toLowerCase().split(' ').map((w) => w.replace(/^\w/, (s) => s.toUpperCase())).join(' ') |