Layout

Container

Extra small Small Medium Large Extra l
<576px ≥576px ≥768px ≥992px ≥1200px
.container 100% 540px 720px 960px 1140px
.container-sm 100% 540px 720px 960px 1140px
.container-md 100% 100% 720px 960px 1140px
.container-lg 100% 100% 100% 960px 1140px
.container-xl 100% 100% 100% 100% 1140px
.container-fluid 100% 100% 100% 100% 100%
閱讀全文 »

Braintree

TypeError: braintree.connect is not a function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 修正前 connect()
const gateway = braintree.connect({
environment: braintree.Environment.Sandbox,
merchantId: process.env.BRAINTREE_MERCHANT_ID,
publicKey: process.env.BRAINTREE_PUBLIC_KEY,
privateKey: process.env.BRAINTREE_PRIVATE_KEY,
});

// 修正後 BraintreeGateway()
const gateway = new braintree.BraintreeGateway({
environment: braintree.Environment.Sandbox,
merchantId: process.env.BRAINTREE_MERCHANT_ID,
publicKey: process.env.BRAINTREE_PUBLIC_KEY,
privateKey: process.env.BRAINTREE_PRIVATE_KEY,
});
閱讀全文 »

Briantree sandbox

setup Briantree account

generate API Key( get Merchant ID, Public Key, Private Key)

login Briantree –> API –> Generate New API Key –> get API key

閱讀全文 »

event include parameter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export default function Checkbox({ categories, handleFilters }) {
const [checked, setChecked] = useState([]);

// ***--->>> event include parameter
const handleToggle = (c) => (e) => {
// return the first index or -1
const currentCategoryId = checked.indexOf(c);
const newCheckedCategoryId = [...checked];
// if current checked was not already in checked state > push
// else pull/take off
if (currentCategoryId === -1) {
newCheckedCategoryId.push(c);
} else {
newCheckedCategoryId.splice(currentCategoryId, 1);
}
setChecked(newCheckedCategoryId);
handleFilters(newCheckedCategoryId);
};

return categories.map((c, i) => (
<li key={i} className="list-unstyled">
{/* ***--->>> event include parameter */}
<input
onChange={handleToggle(c._id)}
value={checked.indexOf(c._id) === -1}
type="checkbox"
className="form-check-input"
/>
<label htmlFor="form-check-label">{c.name}</label>
</li>
));
}
閱讀全文 »

名詞

  • Common clocking : 使用相同的 clock
  • SRNS(separate reference clock no SSC) : no SSC (須要求 clock 準確度)
  • SRIS(separate reference clock independent SSC)
  • SSC(spread spectrum clock) isolation
  • PSW(Program Status Word)
閱讀全文 »

Express

install

  • express
  • dotenv : env 設定
  • nodemon : node 修改自動重啟
1
2
3
4
# npm init
npm init -y
# install module
npm install express dotenv nodemon
閱讀全文 »

material-ui

install

1
2
3
4
# install material core
npm i @material-ui/core
# install material icons
npm i @material-ui/icons
閱讀全文 »

環境建置

webpack

install
1
2
3
4
mkdir react-self-app
cd react-self-app
npm init
yarn add webpack webpack-cli
閱讀全文 »