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
type TodoItem = { | |
title: string | |
completed: boolean | |
} | |
type TodoState = { | |
// ชนิดของ filter ที่ toggle อยู่ | |
filter: "All" | "Active" | "Completed", | |
// Todo ทั้งหมด |
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
// NOW ( currently on alpha 14 nov 2018 ) THIS COMPONENT CAN HAVE STATE | |
const MyInputComponent ({ }) => { | |
const [value, setValue] = React.useState("put some default value here") | |
const onChange = (e) => setValue(e.value.target) | |
return ( | |
<input value={value} onChange={onChange} /> | |
) | |
} |
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
// THIS COMPONENT CANNOT HAVE STATE | |
const MyInputComponent ({ value, onChange }) => { | |
return ( | |
<input value={value} onChange={onChange} /> | |
) | |
} | |
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
## BK1 deployment script with SSH | |
if [ -z "$SSH_DEPLOYMENT_SERVER" ] | |
then | |
echo ERROR: please provide SSH_DEPLOYMENT_SERVER variable to deploy instance to server | |
exit 1 | |
else | |
echo Deploy BK1 API server instance to $SSH_DEPLOYMENT_SERVER | |
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
import gql from "graphql-tag" | |
import { ASTNode } from "graphql" | |
export function extractTypeFromSchema( | |
expectTypeName: string[], | |
schema?: ASTNode, | |
result: string[] = [] | |
): string[] { | |
/** | |
* Implementation... |
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
// OOP ? | |
class TheProblemSolver { | |
solve(problem: Problem){ } | |
} | |
const problemSolver = new TheProblemSolver() | |
problemSolver.solve(p) | |
// OR just pure functional if it pure | |
function solveProblem(problem: Problem) { } |
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
Started executing query at Line 1 | |
Msg 515, Level 16, State 2, Line 1 | |
Cannot insert the value NULL into column 'PlantSeason_ID', table 'sam2.dbo.tb_opr_PlantSeason'; column does not allow nulls. INSERT fails. | |
The statement has been terminated. | |
Total execution time: 00:00:00.007 |
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
DROP TABLE tb_opr_plant; | |
CREATE TABLE [dbo].[tb_opr_Plant]( | |
[Plant_ID] [int] IDENTITY(0,1) NOT NULL, | |
[Quota_ID] [int] NULL, | |
[Zone_ID] [int] NULL, | |
[Plant_No] [nvarchar](20) NULL, | |
[Plant_Name] [nvarchar](100) NULL, | |
[Plant_Moo] [int] NULL, | |
[Plant_Province] [nvarchar](150) NULL, |
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 SUBSTRING(MAX(dbo.tb_opr_Control.Control_No), CHARINDEX('-', MAX(dbo.tb_opr_Control.Control_No)) + 1, 4) AS User_EmpCode, RIGHT(MAX(dbo.tb_opr_Control.Control_No), 4) AS MaxRunning, | |
dbo.tb_opr_Control.Control_Creator, dbo.tb_auth_User.User_ID | |
FROM dbo.tb_opr_Control LEFT OUTER JOIN | |
dbo.tb_auth_User ON dbo.tb_opr_Control.Control_Creator = dbo.tb_auth_User.User_Username | |
GROUP BY dbo.tb_opr_Control.Control_Creator, dbo.tb_auth_User.User_ID |
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
export const REVIEW_HIGHLIGHT_QUERY = gql` | |
${BookHighlighReview.fragments.review} | |
query($bookId: MongoID!) { | |
reviews: bookReviewConnection( | |
filter: { bookId: $bookId } | |
first: 3 | |
sort: CREATED_AT_DESC | |
) { | |
count | |
edges { |