Skip to content

Instantly share code, notes, and snippets.

View pjchender's full-sized avatar

Aaron Chen pjchender

View GitHub Profile
@pjchender
pjchender / sunrise-sunset.json
Created October 8, 2019 09:22
11th鐵人賽
This file has been truncated, but you can view the full file.
[
{
"locationName": "臺北",
"time": [
{
"dataTime": "2019-10-09",
"sunrise": "05:49:00",
"sunset": "17:33:00"
},
{
@pjchender
pjchender / FieldArray.js
Last active June 4, 2019 02:08
Reat Formik
/* demo use for array of objects with formik */
import React from 'react';
import { Formik, Field, Form, FieldArray, ErrorMessage } from 'formik';
import Debug from './Debug';
// import * as Yup from 'yup';
// STEP 1: 定義 initialValues
const initialValues = {
friends: [
{
@pjchender
pjchender / 安裝並啟動 Rails 專案.md
Created May 10, 2019 07:00
安裝並啟動 Rails 專案.md

title: "[Rails] 安裝並啟動 Rails 專案" date: 2019-05-09 10:10:10 updated: 2019-05-09 10:10:10 categories:

  • Ruby on Rails tags:
  • rails
  • rvm
  • gem
diff --git a/src/components/AdminQuotationForm.js b/src/components/AdminQuotationForm.js
index 3c3e836..3943673 100644
--- a/src/components/AdminQuotationForm.js
+++ b/src/components/AdminQuotationForm.js
@@ -269,18 +269,21 @@ class AdminQuotationForm extends React.Component {
}
const {
- quoteExpireAt, quoteStartAt, items, explanations, ...rest
+ quoteExpireAt, quoteStartAt, items, explanations, timezone, ...rest
@pjchender
pjchender / drive.js
Created December 26, 2018 08:51
Driver
/* eslint-disable */
import React from 'react';
import { Avatar, Button } from 'antd';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import styled, { ThemeProvider } from 'styled-components';
/* utils */
import { btnReboot, btnHoverTransparentToMajor } from '@/vendor/style-utils';
@pjchender
pjchender / messages.json
Last active December 26, 2018 14:56
Wavbo Messages
{
"bulletinMessages": [
"在非洲,每六十秒,就有一分鐘過去",
"凡是每天喝水的人,有高機率在 100 年內死去",
"每呼吸 60 秒,就減少一分鐘的壽命",
"誰能想的到,這名 16 歲少女,在四年前,只是一名 12 歲少女",
"台灣人在睡覺時,大多數的美國人都在工作",
"當蝴蝶在南半球拍了兩下翅膀,牠就會稍微飛高一點點",
"據統計,未婚生子的人數中有高機率為女性",
"只要每天省下買一杯奶茶的錢,十天後就能買十杯奶茶",
@pjchender
pjchender / advanced_this.js
Last active August 8, 2018 15:58
[AC] What is this?
let alphaPhoneX = {
name: 'AlphaPhoneX',
price: 14999,
features: ['long battery life', 'AI camera'],
showPhoneInfo: function () {
console.log('this now refers to', this)
console.log(`The price of ${this.name} is $${this.price}`)
}
}
@pjchender
pjchender / create object.js
Last active August 8, 2018 15:34
[AC] Object creating and constructor function
let alphaPhoneX = {
name: 'AlphaPhoneX', // String
price: 14999, // Number
features: ['long battery life', 'AI camera'], // Array
showSpec: function() { // Function
console.log('show the spec of the phone')
},
hardware: { // Object
ram: '8GB',
storage: '64GB'
@pjchender
pjchender / MDN 上的範例.js
Last active August 10, 2018 09:02
[AC] constructor function and prototypal inheritance
function Person(name, interests) {
this.name = name;
this.interests = interests;
};
Person.prototype.greeting = function() {
console.log(`Hi! I'm ${this.name}.`);
};
function Teacher(name, interests, subject) {
@pjchender
pjchender / Async Await 基本使用.js
Last active November 28, 2023 12:38
Promise and Async/Await Example
// async function 本身會回傳 Promise,
// 因此 async function 之後也可以用 `.then()` 串起來
main().then(value => {
console.log(value);
});
async function main () {
console.log('start fn') // STEP 1-1
let val = await get() // STEP 1-2