Skip to content

Instantly share code, notes, and snippets.

View khanghoang's full-sized avatar
😬

Khang Hoang khanghoang

😬
  • Dropbox
  • San Jose, CA
  • 04:33 (UTC -06:00)
  • X @khanght
View GitHub Profile
@khanghoang
khanghoang / readme.md
Last active April 21, 2020 01:25
Getting the PayPal's debug-id

For Chrome

1. Open Inspector

Right click on the page -> Select Inspect -> Select Network tab image

2. Looking for EC token

Click on the credit card icon to open Inline Guest.
Search for counter.cgi in the Network tab image

@khanghoang
khanghoang / writing-the-plugin.md
Last active August 18, 2019 01:52
Neovim plugins

Enable CodeLens in coc.nvim

You'll also need to enable the code lens feature in coc (:CocConfig):

"codeLens.enable": true

Neovim-client

Create a channel to communicate with NeoVim and its plugins https://github.com/chemzqm/node-client.
For example, you can execute a script from the plugin using

@khanghoang
khanghoang / grab.signal.js
Created April 21, 2018 22:29
grab.signal.js
/* @flow */
class Signal {
value: any;
fns: Array<Function>
constructor(value: any) {
this.value = value;
this.fns = [];
}
@khanghoang
khanghoang / config-init.sh
Last active April 4, 2018 01:48
config-init.sh
git init --bare $HOME/.cfg
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
config config --local status.showUntrackedFiles no
echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.zshrc
@khanghoang
khanghoang / mockFetchAction.js
Created April 21, 2017 16:30
Mock Fetch Action
import { ACTIONS } from 'redux-api-call';
export default (makeFetchAction, data) => (name, apiFn) => {
const {
dataSelector,
actionCreator,
isFetchingSelector,
errorSelector,
updater,
} = makeFetchAction(name, apiFn);
@khanghoang
khanghoang / redux-api-call.md
Last active April 21, 2017 16:11
Redux-api-call test utils

Pain point #1

Redux-api-call's makeFetchAction comes with its own dataSelector, but in real world, we can't just grab and use it. We may need to write our selector which bases on dataSelector.
Then when we write our unit test of that selector, we have to setup state which has api_calls property and the response. For example:

const state = {
  // some other properties
  api_calls: {
    fooApi: {
@khanghoang
khanghoang / fancy-utility-color-functions.js
Created March 14, 2017 05:04
Javascript color manipulation
// @flow
/**
Validate Hex
==============================
@param {String} hex
1. remove hash if present
2. convert from 3 to 6 digit color code & ensure valid hex
*/
@khanghoang
khanghoang / You-dont-know-React-Native.md
Last active December 13, 2016 12:01
You-dont-know-React-Native

class: middle, center, inverse

#You don't know React Native @khanght
Employment Hero
facebook.vn/groups/reactvn/

???

What is the purpose of this talk? Just one thing, when you buddy asks you "Hey, i just heard about React Native Native, do you know about it?" you can answer with confidence "Yes, I do"

@khanghoang
khanghoang / README.md
Created August 5, 2016 15:07 — forked from ryansch/README.md
neovim + yadr