This file contains 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
// on client request | |
const xhr = new XMLHttpRequest() | |
// request to api endpoint | |
xhr.open('post', '/documents.zip') | |
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8') | |
xhr.onprogress = () => { | |
// receive stream | |
console.log('PROGRESS:', xhr.responseText) |
This file contains 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 * as React from 'react' | |
import { graphql } from 'react-apollo' | |
import gql from 'graphql-tag' | |
const USER_INFOMATION_QUERY = gql` | |
query { | |
user { | |
_id | |
This file contains 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 function graphql< | |
TProps extends TGraphQLVariables | {} = {}, | |
TData = {}, | |
TGraphQLVariables = {}, | |
TChildProps = Partial<DataProps<TData, TGraphQLVariables>> & | |
Partial<MutateProps<TData, TGraphQLVariables>> | |
>( | |
document: DocumentNode, | |
operationOptions: OperationOption<TProps, TData, TGraphQLVariables, TChildProps> = {}, |
This file contains 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 { USER_INFOMATION_QUERY, USER_NOTIFICATION_QUERY, USER_INFOMATION_MUTATION } from './user.graphql' | |
import { graphql, compose } from 'react-apollo' | |
import UserInfomationComponent from './user.component' | |
// need to defined shape of | |
// prop types from enhanced component | |
type UserInfomationContainerPropTypes = { | |
userId: string |
This file contains 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 { USER_INFOMATION_QUERY, USER_NOTIFICATION_QUERY, USER_INFOMATION_MUTATION } from './user.graphql' | |
import { graphql, compose } from 'react-apollo' | |
import UserInfomationComponent from './user.component' | |
// need to defined shape of | |
// prop types from enhanced component | |
type UserInfomationContainerPropTypes = { | |
userId: string |
This file contains 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 { |
This file contains 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 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 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 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) { } |